diff options
author | Joss Armstrong <joss.armstrong@ericsson.com> | 2019-03-05 14:55:41 +0000 |
---|---|---|
committer | Takamune Cho <takamune.cho@att.com> | 2019-03-07 00:32:44 +0000 |
commit | 8305b22009a8f257e91585f91cfa5d5ed6bc4164 (patch) | |
tree | 9388e430617be72fe0b935ac71629bdd14edc68e /appc-inbound | |
parent | 567a72bdcc1e653d444d45ebde6b8b749776b27e (diff) |
Test coverage in RequestValidator
Increased coverage from 61% to 79%
Issue-ID: APPC-1436
Change-Id: I4a372d40b5593f32685b09c5240654dab0aee968
Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-inbound')
-rw-r--r-- | appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/dbervices/RequestValidatorTest.java | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/dbervices/RequestValidatorTest.java b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/dbervices/RequestValidatorTest.java new file mode 100644 index 000000000..c0ced1f68 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/dbervices/RequestValidatorTest.java @@ -0,0 +1,72 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2019 Ericsson + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END========================================================= + */ + +package org.onap.appc.design.dbervices; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Mockito; +import org.onap.appc.design.services.util.DesignServiceConstants; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import java.io.IOException; + +public class RequestValidatorTest { + + + @Rule + public ExpectedException expectedEx = ExpectedException.none(); + + @Test + public void testValidateArtifactWithVersion() throws RequestValidationException, IOException { + RequestValidator.validate(DesignServiceConstants.GETAPPCTIMESTAMPUTC, "{}"); + expectedEx.expect(RequestValidationException.class); + expectedEx.expectMessage("Missing input parameter :-artifact-contents -:"); + RequestValidator.validate(DesignServiceConstants.UPLOADADMINARTIFACT, "{\"" + + DesignServiceConstants.ARTIFACT_NAME + "\":\"reference\", \"" + + DesignServiceConstants.ARTIFACT_VERSOIN + "\":\"VERSION\"}"); + } + + @Test + public void testValidateArtifact() throws RequestValidationException, IOException { + RequestValidator.validate(DesignServiceConstants.GETAPPCTIMESTAMPUTC, "{}"); + expectedEx.expect(RequestValidationException.class); + expectedEx.expectMessage("Missing input parameter :-artifact-version -:"); + RequestValidator.validate(DesignServiceConstants.UPLOADADMINARTIFACT, "{\"" + + DesignServiceConstants.ARTIFACT_NAME + "\":\"reference\"}"); + } + + @Test + public void testValidateVnf() throws RequestValidationException, IOException { + expectedEx.expect(RequestValidationException.class); + expectedEx.expectMessage("Missing input parameter :-vnf-type -:"); + RequestValidator.validate(DesignServiceConstants.CHECKVNF, "{}"); + } + + @Test + public void testValidateInvalidAction() throws RequestValidationException, IOException { + expectedEx.expect(RequestValidationException.class); + expectedEx.expectMessage(" Action INVALID_ACTION not found while processing request "); + RequestValidator.validate("INVALID_ACTION", "{}"); + } +} |