16
16
17
17
package io .grpc .netty ;
18
18
19
+ import static com .google .common .truth .Truth .assertThat ;
19
20
import static io .grpc .netty .NettyServerTransport .getLogLevel ;
20
21
import static org .junit .Assert .assertEquals ;
21
22
import static org .junit .Assert .assertNull ;
@@ -34,27 +35,25 @@ public void unknownException() {
34
35
}
35
36
36
37
@ Test
37
- public void quiet () {
38
+ public void ioException () {
38
39
assertEquals (Level .FINE , getLogLevel (new IOException ("Connection reset by peer" )));
39
40
assertEquals (Level .FINE , getLogLevel (new IOException (
40
41
"An existing connection was forcibly closed by the remote host" )));
41
42
}
42
43
43
44
@ Test
44
- public void quiet_prefixed () {
45
- assertEquals (Level .FINE , getLogLevel (new IOException (
46
- "syscall:read(..) failed: Connection reset by peer" )));
45
+ public void ioException_nullMessage () {
46
+ IOException e = new IOException ();
47
+ assertNull (e .getMessage ());
48
+ assertEquals (Level .FINE , getLogLevel (e ));
47
49
}
48
50
49
51
@ Test
50
- public void nonquiet () {
51
- assertEquals (Level .INFO , getLogLevel (new IOException ("foo" )));
52
- }
52
+ public void extendedIoException () {
53
+ class ExtendedIoException extends IOException {}
53
54
54
- @ Test
55
- public void nullMessage () {
56
- IOException e = new IOException ();
57
- assertNull (e .getMessage ());
58
- assertEquals (Level .INFO , getLogLevel (e ));
55
+ ExtendedIoException e = new ExtendedIoException ();
56
+ assertThat (e .getMessage ()).isNull ();
57
+ assertThat (getLogLevel (e )).isEqualTo (Level .INFO );
59
58
}
60
59
}
0 commit comments