converted test to dynamic port 73/62373/1
authorBenjamin, Max (mb388a) <mb388a@us.att.com>
Fri, 24 Aug 2018 17:10:42 +0000 (13:10 -0400)
committerBenjamin, Max (mb388a) <mb388a@us.att.com>
Fri, 24 Aug 2018 17:10:53 +0000 (13:10 -0400)
Change-Id: Iab26b24d9178685061cde7de7f78562f17d20e78
Issue-ID: SO-905
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java

index bbdaa94..17ede2f 100644 (file)
@@ -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