diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-08-22 16:14:16 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-08-22 16:14:16 +0000 |
commit | 705da1af1c1f5ca815436bb562e1870905d5cc07 (patch) | |
tree | c1d7cba85938fc6cb08ecdbae20f1da3b71d7d63 /vid-app-common/src | |
parent | 68668ebbd7b0fbc61871e5b3ee6b25cf809a2d4c (diff) | |
parent | c3079e541d084fcc5966771a7f4fd4508a5248a8 (diff) |
Merge "extract constant in MsoBusinessLogicImplTest"
Diffstat (limited to 'vid-app-common/src')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java | 13 |
1 files changed, 7 insertions, 6 deletions
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<String> mockForGetOrchestrationRequest() { HttpResponse<String> httpResponse = mock(HttpResponse.class); - HttpResponseWithRequestInfo<String> httpResponseWithRequestInfo = new HttpResponseWithRequestInfo<>(httpResponse, "my pretty url", HttpMethod.GET); + HttpResponseWithRequestInfo<String> 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")); } |