55import me .proxer .library .api .ProxerApi .Builder .LoggingStrategy ;
66import okhttp3 .Request ;
77import okhttp3 .mockwebserver .MockResponse ;
8- import org .graalvm .compiler .core .common .SuppressFBWarnings ;
98import org .junit .After ;
109import org .junit .Before ;
1110import org .junit .Test ;
1211
1312import java .io .ByteArrayOutputStream ;
1413import java .io .IOException ;
14+ import java .nio .charset .StandardCharsets ;
1515import java .security .GeneralSecurityException ;
1616import java .util .concurrent .CountDownLatch ;
1717import java .util .logging .Formatter ;
@@ -31,10 +31,6 @@ public class LoggingInterceptorTest extends ProxerTest {
3131 private Handler loggerHandler ;
3232 private Logger logger ;
3333
34- @ SuppressFBWarnings (
35- value = "LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE" ,
36- justification = "False positive? Logger has a hard reference."
37- )
3834 @ Override
3935 @ Before
4036 public void setUp () throws IOException , GeneralSecurityException {
@@ -68,7 +64,7 @@ public void testLog() throws IOException, ProxerException {
6864 loggerHandler .flush ();
6965 loggerStream .flush ();
7066
71- assertThat (loggerStream .toString ("UTF-8" )).isEqualTo ("Requesting https://"
67+ assertThat (loggerStream .toString (StandardCharsets . UTF_8 )).isEqualTo ("Requesting https://"
7268 + server .getHostName () + ":" + server .getPort ()
7369 + "/api/v1/notifications/news with method GET and these headers:\n "
7470 + "proxer-api-key: mockKey\n "
@@ -88,7 +84,7 @@ public void testLogWithBody() throws IOException, ProxerException {
8884 loggerHandler .flush ();
8985 loggerStream .flush ();
9086
91- assertThat (loggerStream .toString ("UTF-8" )).isEqualTo ("Requesting https://"
87+ assertThat (loggerStream .toString (StandardCharsets . UTF_8 )).isEqualTo ("Requesting https://"
9288 + server .getHostName () + ":" + server .getPort ()
9389 + "/api/v1/user/login with method POST, these headers:\n "
9490 + "proxer-api-key: mockKey\n "
@@ -109,7 +105,7 @@ public void testLogWithEmptyBody() throws IOException, ProxerException {
109105 loggerHandler .flush ();
110106 loggerStream .flush ();
111107
112- assertThat (loggerStream .toString ("UTF-8" )).isEqualTo ("Requesting https://"
108+ assertThat (loggerStream .toString (StandardCharsets . UTF_8 )).isEqualTo ("Requesting https://"
113109 + server .getHostName () + ":" + server .getPort ()
114110 + "/api/v1/user/logout with method POST, these headers:\n "
115111 + "proxer-api-key: mockKey\n "
@@ -129,7 +125,7 @@ public void testLogAllOtherHost() throws IOException {
129125 loggerHandler .flush ();
130126 loggerStream .flush ();
131127
132- assertThat (loggerStream .toString ("UTF-8" )).isEqualTo ("Requesting http://"
128+ assertThat (loggerStream .toString (StandardCharsets . UTF_8 )).isEqualTo ("Requesting http://"
133129 + server .getHostName () + ":" + server .getPort ()
134130 + "/test with method GET and no headers." );
135131 }
@@ -147,7 +143,7 @@ public void testLogApiOnly() throws IOException {
147143 loggerHandler .flush ();
148144 loggerStream .flush ();
149145
150- assertThat (loggerStream .toString ("UTF-8" )).isEmpty ();
146+ assertThat (loggerStream .toString (StandardCharsets . UTF_8 )).isEmpty ();
151147 }
152148
153149 @ Test
@@ -163,7 +159,7 @@ public void testLogNone() throws IOException {
163159 loggerHandler .flush ();
164160 loggerStream .flush ();
165161
166- assertThat (loggerStream .toString ("UTF-8" )).isEmpty ();
162+ assertThat (loggerStream .toString (StandardCharsets . UTF_8 )).isEmpty ();
167163 }
168164
169165 @ Test
0 commit comments