77import okhttp3 .mockwebserver .MockResponse ;
88import org .junit .After ;
99import org .junit .Before ;
10- import org .junit .Ignore ;
1110import org .junit .Test ;
1211
1312import java .io .ByteArrayOutputStream ;
@@ -54,13 +53,13 @@ public void testLog() throws IOException, ProxerException {
5453
5554 loggerHandler .flush ();
5655
57- assertThat (loggerStream .toString ()).isEqualTo ("Requesting http://localhost:" + server .getPort ()
56+ assertThat (loggerStream .toString ()).isEqualTo ("Requesting http://"
57+ + server .getHostName () + ":" + server .getPort ()
5858 + "/api/v1/notifications/news with method GET and these headers:\n "
5959 + "proxer-api-key: mockKey\n "
6060 + "User-Agent: ProxerLibJava/" + BuildConfig .VERSION );
6161 }
6262
63- @ Ignore ("Somehow flaky" )
6463 @ Test
6564 public void testLogWithBody () throws IOException , ProxerException , InterruptedException {
6665 api = constructApi ().loggingStrategy (LoggingStrategy .ALL ).build ();
@@ -72,7 +71,8 @@ public void testLogWithBody() throws IOException, ProxerException, InterruptedEx
7271
7372 loggerHandler .flush ();
7473
75- assertThat (loggerStream .toString ()).isEqualTo ("Requesting http://localhost:" + server .getPort ()
74+ assertThat (loggerStream .toString ()).isEqualTo ("Requesting http://"
75+ + server .getHostName () + ":" + server .getPort ()
7676 + "/api/v1/user/login with method POST, these headers:\n "
7777 + "proxer-api-key: mockKey\n "
7878 + "User-Agent: ProxerLibJava/" + BuildConfig .VERSION + "\n and this body:\n "
@@ -90,7 +90,8 @@ public void testLogWithEmptyBody() throws IOException, ProxerException {
9090
9191 loggerHandler .flush ();
9292
93- assertThat (loggerStream .toString ()).isEqualTo ("Requesting http://localhost:" + server .getPort ()
93+ assertThat (loggerStream .toString ()).isEqualTo ("Requesting http://"
94+ + server .getHostName () + ":" + server .getPort ()
9495 + "/api/v1/user/logout with method POST, these headers:\n "
9596 + "proxer-api-key: mockKey\n "
9697 + "User-Agent: ProxerLibJava/" + BuildConfig .VERSION + "\n and a blank body." );
@@ -105,7 +106,8 @@ public void testLogAllOtherHost() throws IOException, ProxerException {
105106
106107 loggerHandler .flush ();
107108
108- assertThat (loggerStream .toString ()).isEqualTo ("Requesting http://localhost:" + server .getPort ()
109+ assertThat (loggerStream .toString ()).isEqualTo ("Requesting http://"
110+ + server .getHostName () + ":" + server .getPort ()
109111 + "/test with method GET and no headers." );
110112 }
111113
0 commit comments