Skip to content

Commit 139fe16

Browse files
committed
test: fix failing test
1 parent c93f711 commit 139fe16

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

  • rollbar-reactive-streams/src/test/java/com/rollbar/reactivestreams/notifier

rollbar-reactive-streams/src/test/java/com/rollbar/reactivestreams/notifier/RollbarTest.java

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
import static org.hamcrest.MatcherAssert.assertThat;
66
import static org.hamcrest.Matchers.sameInstance;
77
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.*;
119

1210
import com.rollbar.api.payload.data.Level;
1311
import com.rollbar.notifier.sender.result.Response;
@@ -18,7 +16,6 @@
1816
import java.util.HashMap;
1917
import java.util.Map;
2018

21-
import org.apache.hc.core5.http.ConnectionClosedException;
2219
import org.junit.Before;
2320
import org.junit.Rule;
2421
import org.junit.Test;
@@ -73,22 +70,15 @@ public void shouldDoNothingIfDisabled() {
7370

7471
@Test
7572
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();
7776

7877
Rollbar sut = new Rollbar(config);
7978

8079
Throwable error = new RuntimeException("Something went wrong.");
8180

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();
9282
}
9383

9484
@Test

0 commit comments

Comments
 (0)