sonar work
diff --git a/src/test/java/pta/de/core/common/util/ResourceLoaderBaseTest.java b/src/test/java/pta/de/core/common/util/ResourceLoaderBaseTest.java index c310452..c56e0bd 100644 --- a/src/test/java/pta/de/core/common/util/ResourceLoaderBaseTest.java +++ b/src/test/java/pta/de/core/common/util/ResourceLoaderBaseTest.java
@@ -10,6 +10,6 @@ public void testloadStringFromResourceError() { ResourceLoaderBase rlb = new ResourceLoaderBase(); String str = rlb.loadStringFromResource("UNKNOWN_FILE"); - assertEquals(str, ""); + assertEquals("", str); } }
diff --git a/src/test/java/pta/de/core/controller/BackendControllerTest.java b/src/test/java/pta/de/core/controller/BackendControllerTest.java index 5bbf126..e13534f 100644 --- a/src/test/java/pta/de/core/controller/BackendControllerTest.java +++ b/src/test/java/pta/de/core/controller/BackendControllerTest.java
@@ -35,9 +35,9 @@ ServiceDistributionCluster sdc = baseTestReadServerDistribution("elogbook.openK", "testServiceDistributions.json"); - assertEquals(sdc.getClustername(), "elogbook.openK"); - assertEquals(sdc.getDistributions().length, 1); - assertEquals(sdc.getDistributions()[0].getHost(), "172.18.22.160"); + assertEquals("elogbook.openK", sdc.getClustername()); + assertEquals(1, sdc.getDistributions().length); + assertEquals("172.18.22.160", sdc.getDistributions()[0].getHost()); } @Test @@ -45,7 +45,7 @@ try { baseTestReadServerDistribution("doesntMatter", "testServiceDist_False.json"); } catch( HttpStatusException e ) { - assertEquals(e.getHttpStatus(), HttpStatus.INTERNAL_SERVER_ERROR_500); + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR_500, e.getHttpStatus()); } } @@ -54,7 +54,7 @@ try { ServiceDistributionCluster sdc = baseTestReadServerDistribution("invalidCluster", "testServiceDistributions.json"); } catch( HttpStatusException e ) { - assertEquals(e.getHttpStatus(), HttpStatus.NOT_FOUND_404); + assertEquals(HttpStatus.NOT_FOUND_404, e.getHttpStatus()); } }
diff --git a/src/test/java/pta/de/core/controller/BaseWebServiceTest.java b/src/test/java/pta/de/core/controller/BaseWebServiceTest.java index 81ee73f..e6899e0 100644 --- a/src/test/java/pta/de/core/controller/BaseWebServiceTest.java +++ b/src/test/java/pta/de/core/controller/BaseWebServiceTest.java
@@ -1,18 +1,13 @@ package pta.de.core.controller; -import org.apache.log4j.Logger; import org.eclipse.jetty.http.HttpStatus; -import org.junit.Assert; import org.junit.Test; import org.powermock.reflect.Whitebox; -import pta.de.core.common.JsonGeneratorBase; import pta.de.core.common.util.ResourceLoaderBase; import pta.de.core.exceptions.HttpStatusException; - import javax.ws.rs.core.Response; - import static org.junit.Assert.*; public class BaseWebServiceTest extends ResourceLoaderBase { @@ -37,21 +32,21 @@ @Test public void testInvokeRunnableOK() { Response r = createBaseWebService().invokeRunnable(createInvokable("Test Ok", null)); - assertEquals(r.getStatus(), HttpStatus.OK_200); + assertEquals(HttpStatus.OK_200, r.getStatus()); } @Test public void testInvokeRunnable_HttpStatusException() { Response r = createBaseWebService().invokeRunnable(createInvokable(null, new HttpStatusException(HttpStatus.BAD_REQUEST_400))); - assertEquals(r.getStatus(), HttpStatus.BAD_REQUEST_400); + assertEquals(HttpStatus.BAD_REQUEST_400, r.getStatus()); } @Test public void testInvokeRunnable_GeneralException() { Response r = createBaseWebService().invokeRunnable(createInvokable( null, new Exception("hallodri"))); - assertEquals(r.getStatus(), HttpStatus.INTERNAL_SERVER_ERROR_500); + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR_500, r.getStatus()); } @Test
diff --git a/src/test/java/pta/de/core/controller/ServicesConfigCacheTest.java b/src/test/java/pta/de/core/controller/ServicesConfigCacheTest.java index 95ae466..b1b7772 100644 --- a/src/test/java/pta/de/core/controller/ServicesConfigCacheTest.java +++ b/src/test/java/pta/de/core/controller/ServicesConfigCacheTest.java
@@ -25,9 +25,9 @@ ServiceDistributionCluster[] sdc = baseTestReadServerDistribution("testServiceDistributions.json"); - assertEquals(sdc[0].getClustername(), "elogbook.openK"); - assertEquals(sdc[0].getDistributions().length, 1); - assertEquals(sdc[0].getDistributions()[0].getHost(), "172.18.22.160"); + assertEquals("elogbook.openK", sdc[0].getClustername()); + assertEquals(1, sdc[0].getDistributions().length); + assertEquals("172.18.22.160", sdc[0].getDistributions()[0].getHost()); } @Test @@ -35,7 +35,7 @@ try { baseTestReadServerDistribution("testServiceDist_False.json"); } catch( HttpStatusException e ) { - assertEquals(e.getHttpStatus(), HttpStatus.INTERNAL_SERVER_ERROR_500); + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR_500, e.getHttpStatus()); } } @@ -44,7 +44,7 @@ try { baseTestReadServerDistribution("Nowhere.json"); } catch (HttpStatusException e) { - assertEquals(e.getHttpStatus(), HttpStatus.INTERNAL_SERVER_ERROR_500); + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR_500, e.getHttpStatus()); } }
diff --git a/src/test/java/pta/de/core/exceptions/HttpStatusExceptionTest.java b/src/test/java/pta/de/core/exceptions/HttpStatusExceptionTest.java index 9779181..51e5fad 100644 --- a/src/test/java/pta/de/core/exceptions/HttpStatusExceptionTest.java +++ b/src/test/java/pta/de/core/exceptions/HttpStatusExceptionTest.java
@@ -10,6 +10,6 @@ @Test public void testAll() { HttpStatusException hse = new HttpStatusException( 200 ); - assertEquals( hse.getHttpStatus(), HttpStatus.OK_200); + assertEquals(HttpStatus.OK_200, hse.getHttpStatus()); } }
diff --git a/src/test/java/pta/de/resources/MicsCentralResourceTest.java b/src/test/java/pta/de/resources/MicsCentralResourceTest.java index 1940867..3562fd1 100644 --- a/src/test/java/pta/de/resources/MicsCentralResourceTest.java +++ b/src/test/java/pta/de/resources/MicsCentralResourceTest.java
@@ -6,6 +6,7 @@ import pta.de.core.exceptions.HttpStatusException; import javax.ws.rs.core.Response; + import static junit.framework.TestCase.assertNotNull; import static org.junit.Assert.assertEquals; @@ -21,6 +22,6 @@ ServicesConfigCache.getInstance().readServerDistribution("servicesDistributionDevLocal.json"); Response r = new MicsCentralResource().getServiceDistribution("elogbook.openK" ); - assertEquals( r.getStatus(), HttpStatus.OK_200 ); + assertEquals(HttpStatus.OK_200, r.getStatus()); } }