From 0d2076f299bf28c919e5640e15c8359d3d134e75 Mon Sep 17 00:00:00 2001 From: Roque Santos Date: Wed, 3 Jun 2020 19:51:49 -0300 Subject: [PATCH] BAEL-3844 - Suggested adjustements --- ...estFactoryLiveTest.java => RequestFactoryUnitTest.java} | 7 +++++-- ...erLiveTest.java => RestTemplateCustomizerUnitTest.java} | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) rename spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/{RequestFactoryLiveTest.java => RequestFactoryUnitTest.java} (85%) rename spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/{RestTemplateCustomizerLiveTest.java => RestTemplateCustomizerUnitTest.java} (89%) diff --git a/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryLiveTest.java b/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryUnitTest.java similarity index 85% rename from spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryLiveTest.java rename to spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryUnitTest.java index f9ca66f14d..6959aa8d47 100644 --- a/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryLiveTest.java +++ b/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryUnitTest.java @@ -15,13 +15,16 @@ import org.springframework.http.ResponseEntity; import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; -public class RequestFactoryLiveTest { +public class RequestFactoryUnitTest { + + private static final String PROXY_SERVER_HOST = "127.0.0.1"; + private static final int PROXY_SERVER_PORT = 8080; RestTemplate restTemplate; @Before public void setUp() { - Proxy proxy = new Proxy(Type.HTTP, new InetSocketAddress("201.91.82.155", 3128)); + Proxy proxy = new Proxy(Type.HTTP, new InetSocketAddress(PROXY_SERVER_HOST, PROXY_SERVER_PORT)); SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); requestFactory.setProxy(proxy); diff --git a/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerLiveTest.java b/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerUnitTest.java similarity index 89% rename from spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerLiveTest.java rename to spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerUnitTest.java index 8f318b758b..b35283bdcf 100644 --- a/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerLiveTest.java +++ b/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerUnitTest.java @@ -20,7 +20,10 @@ import org.springframework.http.ResponseEntity; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; -public class RestTemplateCustomizerLiveTest { +public class RestTemplateCustomizerUnitTest { + + private static final String PROXY_SERVER_HOST = "127.0.0.1"; + private static final int PROXY_SERVER_PORT = 8080; RestTemplate restTemplate; @@ -40,7 +43,7 @@ public class RestTemplateCustomizerLiveTest { @Override public void customize(RestTemplate restTemplate) { - HttpHost proxy = new HttpHost("201.91.82.155", 3128); + HttpHost proxy = new HttpHost(PROXY_SERVER_HOST, PROXY_SERVER_PORT); HttpClient httpClient = HttpClientBuilder.create() .setRoutePlanner(new DefaultProxyRoutePlanner(proxy) { @Override