private void populateEnvironmentMaps( String application, EnvironmentProperties environmentProperties) { testProperties.put(application, environmentProperties.getTest().getUrl()); uatProperties.put(application, environmentProperties.getUat().getUrl()); demoProperties.put(application, environmentProperties.getDemo().getUrl()); prodProperties.put(application, environmentProperties.getProd().getUrl()); }
@Test public void shouldGetEnvProps() throws IOException, URISyntaxException { // Given String url = "http://localhost:8080/%s/version"; MockRestServiceServer mockServer = MockRestServiceServer.createServer(restTemplate); String body = loadJsonFile(); mockServer .expect(requestTo("http://localhost:8080/test/version")) .andExpect(method(HttpMethod.GET)) .andRespond(withSuccess(body, MediaType.APPLICATION_JSON)); willReturn(restTemplate).given(restClient).getRestTemplate(); restClient.setUrl(url); // When EnvironmentProperties environmentProperties = restClient.getEnvironmentProperties("test"); // Then Assert.assertEquals( "Test expectedName should be", "test", environmentProperties.getTest().getExpectedName()); }