diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-08-24 13:10:42 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-08-24 13:10:53 -0400 |
commit | e27650bc7ca78bfc1b54e5423cc72b2a44064df3 (patch) | |
tree | e132ea15ad6492f5bbe029fbb6db4d1549c24aed | |
parent | 581e8f851a163fca42a1bf3175afa5707a0677fe (diff) |
converted test to dynamic port
Change-Id: Iab26b24d9178685061cde7de7f78562f17d20e78
Issue-ID: SO-905
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
-rw-r--r-- | bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java index bbdaa94581..17ede2f2ff 100644 --- a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java +++ b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java @@ -51,7 +51,8 @@ public class RESTClientTest { private String jsonResponseAsString; @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090)); + public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort()); + @Before public void before() throws Exception { @@ -62,7 +63,7 @@ public class RESTClientTest { jsonResponse = new JSONObject(); jsonResponse.put("response", "responseValue"); jsonResponseAsString = jsonResponse.toString(); - restClient = new RESTClient("http://localhost:28090/example", "localhost", 28090); + restClient = new RESTClient("http://localhost:" + wireMockRule.port() + "/example", "localhost", wireMockRule.port()); } @Test @@ -79,9 +80,9 @@ public class RESTClientTest { assertEquals(1, restClient.getParameters().size()); restClient.addAuthorizationHeader("token"); assertEquals("[token]", restClient.getHeaders().get("Authorization").toString()); - assertEquals("http://localhost:28090/example", restClient.getURL()); - restClient = new RESTClient("http://localhost:28090/example1"); - assertEquals("http://localhost:28090/example1", restClient.getURL()); + assertEquals("http://localhost:" + wireMockRule.port() + "/example", restClient.getURL()); + restClient = new RESTClient("http://localhost:" + wireMockRule.port() + "/example1"); + assertEquals("http://localhost:" + wireMockRule.port() + "/example1", restClient.getURL()); } @Test |