X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ECOMP-PDP-REST%2Fsrc%2Ftest%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fpdp%2Frest%2FXACMLPdpServletTest.java;h=581abbe085acd1aa7a505bca80ec1c4f6b4d6049;hb=87c95be02a8a4d77e165dede90777e811b59dcae;hp=808f421ff6d56d472f116a23bcd426760204369a;hpb=e0addf5b588a1244f9679becd90999dfcb4c3a94;p=policy%2Fengine.git diff --git a/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/XACMLPdpServletTest.java b/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/XACMLPdpServletTest.java index 808f421ff..581abbe08 100644 --- a/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/XACMLPdpServletTest.java +++ b/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/XACMLPdpServletTest.java @@ -33,8 +33,6 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import junit.framework.TestCase; - import org.junit.Before; import org.junit.runner.RunWith; import org.mockito.Mockito; @@ -51,12 +49,14 @@ import org.springframework.mock.web.MockServletConfig; import com.mockrunner.mock.web.MockServletInputStream; +import junit.framework.TestCase; + @RunWith(PowerMockRunner.class) @PrepareForTest(IntegrityMonitor.class) // so PowerMock can mock static method of IntegrityMonitor public class XACMLPdpServletTest extends TestCase{ private static Logger LOGGER = FlexLogger.getLogger(XACMLPdpServletTest.class); - private List headers = new ArrayList(); + private List headers = new ArrayList<>(); private HttpServletRequest httpServletRequest; private HttpServletResponse httpServletResponse; @@ -110,7 +110,7 @@ public class XACMLPdpServletTest extends TestCase{ // when IntegrityMonitor.getInstance is called, return the mock object PowerMockito.when(IntegrityMonitor.getInstance(Mockito.anyString(), Mockito.any(Properties.class))).thenReturn(im); } catch (Exception e1) { - e1.printStackTrace(); + LOGGER.error("Exception Occured"+e1); } try { @@ -127,7 +127,7 @@ public class XACMLPdpServletTest extends TestCase{ pdpServlet.init(servletConfig); assertTrue(true); } catch (Exception e) { - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } @@ -143,7 +143,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch(Exception e){ System.out.println("Unexpected exception in testDoGetNoTypeError"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } } @@ -159,7 +159,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch (Exception e){ System.out.println("Unexpected exception in testDoGetConfigType"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } @@ -176,7 +176,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch(Exception e){ System.out.println("Unexpected exception in testDoGetTypeHb"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } } @@ -190,7 +190,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch(Exception e){ System.out.println("Unexpected exception in testDoGetTypeStatus"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } } @@ -203,7 +203,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch (Exception e){ System.out.println("Unexpected exception in testDoPost"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } } @@ -219,7 +219,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch (Exception e){ System.out.println("Unexpected exception in testDoPostToLong"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } } @@ -235,7 +235,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch (Exception e){ System.out.println("Unexpected exception in testDoPostContentLengthNegative"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } } @@ -251,7 +251,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch (Exception e){ System.out.println("Unexpected exception in testDoPostContentTypeNonValid"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } } @@ -267,7 +267,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch (Exception e){ System.out.println("Unexpected exception in testDoPostContentTypeConfigurationError"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } } @@ -286,7 +286,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch (Exception e){ System.out.println("Unexpected exception in testDoPutCacheEmpty"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } } @@ -307,7 +307,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch (Exception e){ System.out.println("Unexpected exception in testDoPutConfigPolicies"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } } @@ -326,7 +326,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch (Exception e){ System.out.println("Unexpected exception in testDoPutToLong"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } } @@ -345,7 +345,7 @@ public class XACMLPdpServletTest extends TestCase{ assertTrue(true); }catch (Exception e){ System.out.println("Unexpected exception in testDoPutInvalidContentType"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } } @@ -358,7 +358,7 @@ public class XACMLPdpServletTest extends TestCase{ pdpServlet.destroy(); }catch(Exception e){ System.out.println("Unexpected exception in testDestroy"); - e.printStackTrace(); + LOGGER.error("Exception Occured"+e); fail(); } }