Skip to content

Commit eef82fa

Browse files
committed
PR suggestion for test
1 parent d1d1d14 commit eef82fa

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

disk-buffering/src/test/java/io/opentelemetry/contrib/disk/buffering/FromDiskExporterImplTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import static java.util.concurrent.TimeUnit.MILLISECONDS;
1111
import static org.assertj.core.api.Assertions.assertThat;
1212
import static org.mockito.ArgumentMatchers.any;
13+
import static org.mockito.Mockito.doThrow;
1314
import static org.mockito.Mockito.mock;
1415
import static org.mockito.Mockito.when;
1516

@@ -91,11 +92,7 @@ void verifyStorageFolderIsCreated() {
9192

9293
@Test
9394
void whenDeserializationFails_returnFalse() throws IOException {
94-
when(deserializer.deserialize(any()))
95-
.thenAnswer(
96-
invocation -> {
97-
throw new DeserializationException(new IOException("Some exception"));
98-
});
95+
doThrow(DeserializationException.class).when(deserializer).deserialize(any());
9996

10097
assertThat(exporter.exportStoredBatch(1, TimeUnit.SECONDS)).isFalse();
10198
}

0 commit comments

Comments
 (0)