From c3079e541d084fcc5966771a7f4fd4508a5248a8 Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Thu, 22 Aug 2019 17:40:14 +0300 Subject: extract constant in MsoBusinessLogicImplTest Issue-ID: VID-378 Signed-off-by: Eylon Malin Change-Id: I49a50f0762b2db8bcab06340a6407a0ee7970c86 --- .../java/org/onap/vid/mso/MsoBusinessLogicImplTest.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'vid-app-common') diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java index 830862261..ffabc18a2 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java @@ -109,6 +109,7 @@ import org.testng.annotations.Test; public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { private static final ObjectMapper objectMapper = new ObjectMapper(); + private static final String MY_PRETTY_URL = "my pretty url"; @Mock private MsoInterface msoInterface; @@ -1430,7 +1431,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { private HttpResponse mockForGetOrchestrationRequest() { HttpResponse httpResponse = mock(HttpResponse.class); - HttpResponseWithRequestInfo httpResponseWithRequestInfo = new HttpResponseWithRequestInfo<>(httpResponse, "my pretty url", HttpMethod.GET); + HttpResponseWithRequestInfo httpResponseWithRequestInfo = new HttpResponseWithRequestInfo<>(httpResponse, MY_PRETTY_URL, HttpMethod.GET); when(msoInterface.getOrchestrationRequest(any(String.class),anyBoolean())) .thenReturn(httpResponseWithRequestInfo); return httpResponse; @@ -1536,7 +1537,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { final ExternalComponentStatus msoStatus = msoBusinessLogic.probeComponent(); assertMsoStatus(msoStatus, true); - assertMetadata(msoStatus, 200, startsWith(responseString.substring(0, 400)), "my pretty url", equalTo("OK")); + assertMetadata(msoStatus, 200, startsWith(responseString.substring(0, 400)), MY_PRETTY_URL, equalTo("OK")); } @Test @@ -1552,7 +1553,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { assertMsoStatus(msoStatus, true); - assertMetadata(msoStatus, 200, equalTo(responseString), "my pretty url", containsString("OK")); + assertMetadata(msoStatus, 200, equalTo(responseString), MY_PRETTY_URL, containsString("OK")); } @Test @@ -1565,7 +1566,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { assertMsoStatus(msoStatus, false); - assertMetadata(msoStatus, 200, equalTo(responseString), "my pretty url", containsString("JsonParseException: Unrecognized token")); + assertMetadata(msoStatus, 200, equalTo(responseString), MY_PRETTY_URL, containsString("JsonParseException: Unrecognized token")); } @Test @@ -1573,7 +1574,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { String responseString = "my raw data"; when(msoInterface.getOrchestrationRequest(any(), eq(true))).thenThrow( - new ExceptionWithRequestInfo(HttpMethod.GET, "my pretty url", responseString, 406, + new ExceptionWithRequestInfo(HttpMethod.GET, MY_PRETTY_URL, responseString, 406, new GenericUncheckedException( new HttpException("Simulating as 406 was returned (200 or 202 expected)")))); @@ -1581,7 +1582,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { assertMsoStatus(msoStatus, false); - assertMetadata(msoStatus, 406, equalTo(responseString), "my pretty url", containsString("HttpException: Simulating as 406 was returned")); + assertMetadata(msoStatus, 406, equalTo(responseString), MY_PRETTY_URL, containsString("HttpException: Simulating as 406 was returned")); } -- cgit 1.2.3-korg