From bec922a214185c8a16e5766df4f4371a7af40a13 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Mon, 17 Jun 2013 11:48:18 +0200 Subject: [PATCH] Fix Sonar UT on French OS --- .../internal/HttpRequestFactoryTest.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java index dcd8553da77..fdf537b1fa7 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java @@ -44,7 +44,7 @@ public class HttpRequestFactoryTest { httpServer.doReturnStatus(200).doReturnBody("{'issues': []}"); HttpRequestFactory factory = new HttpRequestFactory(httpServer.url()); - String json = factory.get("/api/issues", Collections.emptyMap()); + String json = factory.get("/api/issues", Collections. emptyMap()); assertThat(json).isEqualTo("{'issues': []}"); assertThat(httpServer.requestedPath()).isEqualTo("/api/issues"); @@ -54,13 +54,12 @@ public class HttpRequestFactoryTest { public void should_throw_illegal_state_exc_if_connect_exception() { HttpRequestFactory factory = new HttpRequestFactory("http://localhost:1"); try { - factory.get("/api/issues", Collections.emptyMap()); + factory.get("/api/issues", Collections. emptyMap()); fail(); } catch (Exception e) { assertThat(e).isInstanceOf(IllegalStateException.class); assertThat(e).hasMessage("Fail to request http://localhost:1/api/issues"); - assertThat(e.getCause().getMessage()).contains("Connection refused"); - + assertThat(e.getCause().getMessage()).matches(".*(Connection refused|Connexion refusée).*"); } } @@ -69,7 +68,7 @@ public class HttpRequestFactoryTest { httpServer.doReturnStatus(200).doReturnBody("{}"); HttpRequestFactory factory = new HttpRequestFactory(httpServer.url()); - String json = factory.post("/api/issues/change", Collections.emptyMap()); + String json = factory.post("/api/issues/change", Collections. emptyMap()); assertThat(json).isEqualTo("{}"); assertThat(httpServer.requestedPath()).isEqualTo("/api/issues/change"); @@ -80,7 +79,7 @@ public class HttpRequestFactoryTest { httpServer.doReturnStatus(200).doReturnBody("{}"); HttpRequestFactory factory = new HttpRequestFactory(httpServer.url()).setLogin("karadoc").setPassword("legrascestlavie"); - String json = factory.get("/api/issues", Collections.emptyMap()); + String json = factory.get("/api/issues", Collections. emptyMap()); assertThat(json).isEqualTo("{}"); assertThat(httpServer.requestedPath()).isEqualTo("/api/issues"); @@ -90,10 +89,10 @@ public class HttpRequestFactoryTest { @Test public void test_proxy() throws Exception { HttpRequestFactory factory = new HttpRequestFactory(httpServer.url()) - .setProxyHost("localhost").setProxyPort(1) - .setProxyLogin("john").setProxyPassword("smith"); + .setProxyHost("localhost").setProxyPort(1) + .setProxyLogin("john").setProxyPassword("smith"); try { - factory.get("/api/issues", Collections.emptyMap()); + factory.get("/api/issues", Collections. emptyMap()); fail(); } catch (IllegalStateException e) { // it's not possible to check that the proxy is correctly configured -- 2.39.5