|
5 | 5 | import static org.hamcrest.MatcherAssert.assertThat; |
6 | 6 | import static org.hamcrest.Matchers.sameInstance; |
7 | 7 | import static org.mockito.ArgumentMatchers.any; |
8 | | -import static org.mockito.Mockito.never; |
9 | | -import static org.mockito.Mockito.verify; |
10 | | -import static org.mockito.Mockito.when; |
| 8 | +import static org.mockito.Mockito.*; |
11 | 9 |
|
12 | 10 | import com.rollbar.api.payload.data.Level; |
13 | 11 | import com.rollbar.notifier.sender.result.Response; |
|
18 | 16 | import java.util.HashMap; |
19 | 17 | import java.util.Map; |
20 | 18 |
|
21 | | -import org.apache.hc.core5.http.ConnectionClosedException; |
22 | 19 | import org.junit.Before; |
23 | 20 | import org.junit.Rule; |
24 | 21 | import org.junit.Test; |
@@ -73,22 +70,15 @@ public void shouldDoNothingIfDisabled() { |
73 | 70 |
|
74 | 71 | @Test |
75 | 72 | public void shouldNotThrowExceptionWithEmptyConfig() { |
76 | | - Config config = withAccessToken("access_token").build(); |
| 73 | + Sender mockSender = mock(Sender.class); |
| 74 | + when(mockSender.send(any())).thenReturn(Mono.empty()); |
| 75 | + Config config = withAccessToken("access_token").sender(mockSender).build(); |
77 | 76 |
|
78 | 77 | Rollbar sut = new Rollbar(config); |
79 | 78 |
|
80 | 79 | Throwable error = new RuntimeException("Something went wrong."); |
81 | 80 |
|
82 | | - Mono.from(sut.log(error, null, null, Level.ERROR)) |
83 | | - .onErrorResume(ex -> { |
84 | | - if (ex instanceof ConnectionClosedException) { |
85 | | - return Mono.empty(); |
86 | | - } else { |
87 | | - return Mono.error(ex); |
88 | | - } |
89 | | - } |
90 | | - ) |
91 | | - .block(); |
| 81 | + Mono.from(sut.log(error, null, null, Level.ERROR)).block(); |
92 | 82 | } |
93 | 83 |
|
94 | 84 | @Test |
|
0 commit comments