From 96b5b53cbace0abfdc41f2cf0e20a4eb48f7fcdd Mon Sep 17 00:00:00 2001 From: Bharat saraswal Date: Sun, 17 Sep 2017 15:08:03 +0530 Subject: Fixing checkstyle errors (followed:onap-java-style) removed redundant code. Issue-Id:DCAEGEN2-92 Change-Id: Ie4741757f89357b31ce8968a6f7670db3014d528 Signed-off-by: Bharat saraswal --- .../dcae/vestest/TestCustomExceptionLoader.java | 74 +++++++++++----------- 1 file changed, 38 insertions(+), 36 deletions(-) (limited to 'src/test/java/org/onap/dcae/vestest/TestCustomExceptionLoader.java') diff --git a/src/test/java/org/onap/dcae/vestest/TestCustomExceptionLoader.java b/src/test/java/org/onap/dcae/vestest/TestCustomExceptionLoader.java index bf7dbda2..1cbd6c43 100644 --- a/src/test/java/org/onap/dcae/vestest/TestCustomExceptionLoader.java +++ b/src/test/java/org/onap/dcae/vestest/TestCustomExceptionLoader.java @@ -17,54 +17,56 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.dcae.vestest; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import com.att.nsa.drumlin.service.standards.HttpStatusCodes; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.dcae.commonFunction.CommonStartup; import org.onap.dcae.commonFunction.CustomExceptionLoader; - -import com.att.nsa.drumlin.service.standards.HttpStatusCodes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class TestCustomExceptionLoader { - CustomExceptionLoader cl; - @Before - public void setUp() throws Exception { - cl = new CustomExceptionLoader(); - CommonStartup.exceptionConfig="./etc/ExceptionConfig.json"; - } + private static final Logger log = LoggerFactory.getLogger(TestCustomExceptionLoader.class); + private CustomExceptionLoader cl; + + @Before + public void setUp() throws Exception { + cl = new CustomExceptionLoader(); + CommonStartup.exceptionConfig = "./etc/ExceptionConfig.json"; + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testLoad() { + String op; + CustomExceptionLoader.LoadMap(); + op = "dataloaded"; + assertEquals("dataloaded", op); + } - @After - public void tearDown() throws Exception { - } + @Test + public void testLookup() { + String[] retarray; - @Test - public void testLoad() { - String op = "notloaded"; - CustomExceptionLoader.LoadMap(); - op = "dataloaded"; - assertEquals("dataloaded",op); - } - @Test - public void testLookup() { - String[] retarray = null; - - CommonStartup.exceptionConfig="./etc/ExceptionConfig.json"; - CustomExceptionLoader.LoadMap(); - retarray=CustomExceptionLoader.LookupMap(String.valueOf(HttpStatusCodes.k401_unauthorized), "Unauthorized user"); - if (retarray==null) - { - System.out.println("Lookup failed"); - } - else - { - assertEquals("\"POL2000\"",retarray[0].toString()); - } - - } + CommonStartup.exceptionConfig = "./etc/ExceptionConfig.json"; + CustomExceptionLoader.LoadMap(); + retarray = CustomExceptionLoader + .LookupMap(String.valueOf(HttpStatusCodes.k401_unauthorized), "Unauthorized user"); + if (retarray == null) { + log.info("Lookup failed"); + } else { + assertEquals("\"POL2000\"", retarray[0]); + } + } } -- cgit 1.2.3-korg