Skip to content

Commit 01d37da

Browse files
committed
Update OkHttp and fix tests
1 parent 19df3f7 commit 01d37da

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ buildscript {
1515
javaxExtrasVersion = '0.1.0'
1616

1717
retrofitVersion = '2.3.0'
18-
okHttpVersion = '3.8.1'
18+
okHttpVersion = '3.9.0'
1919
moshiVersion = '1.5.0'
2020

2121
junitVersion = '4.12'

library/src/test/java/me/proxer/library/api/LoggingInterceptorTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import okhttp3.mockwebserver.MockResponse;
88
import org.junit.After;
99
import org.junit.Before;
10-
import org.junit.Ignore;
1110
import org.junit.Test;
1211

1312
import 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 + "\nand 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 + "\nand 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

Comments
 (0)