Skip to content

Commit 75d3f3d

Browse files
committed
test: use static imports for Assert.fail
1 parent 1d5b58b commit 75d3f3d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

core/src/test/java/io/grpc/internal/DelayedClientCallTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import io.grpc.Metadata;
3737
import io.grpc.Status;
3838
import io.grpc.StatusException;
39+
import static org.junit.Assert.fail;
3940
import java.lang.reflect.Method;
4041
import java.lang.reflect.Modifier;
4142
import java.util.Arrays;
@@ -287,7 +288,7 @@ public Void answer(org.mockito.invocation.InvocationOnMock invocation) {
287288

288289
try {
289290
runnable.run();
290-
org.junit.Assert.fail("Should have thrown");
291+
fail("Should have thrown");
291292
} catch (RuntimeException e) {
292293
assertThat(e).isSameInstanceAs(error);
293294
}
@@ -298,7 +299,7 @@ public Void answer(org.mockito.invocation.InvocationOnMock invocation) {
298299
// Verify it transitioned to passThrough by showing it forwards.
299300
try {
300301
delayedListener.onReady();
301-
org.junit.Assert.fail("Should have thrown");
302+
fail("Should have thrown");
302303
} catch (RuntimeException e) {
303304
assertThat(e).isSameInstanceAs(error);
304305
}

core/src/test/java/io/grpc/internal/DelayedStreamTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import static org.junit.Assert.assertNotNull;
2323
import static org.junit.Assert.assertNull;
2424
import static org.junit.Assert.assertTrue;
25+
import static org.junit.Assert.fail;
2526
import static org.mockito.ArgumentMatchers.any;
2627
import static org.mockito.ArgumentMatchers.eq;
2728
import static org.mockito.ArgumentMatchers.same;
@@ -527,7 +528,7 @@ public Void answer(InvocationOnMock invocation) {
527528

528529
try {
529530
runnable.run();
530-
org.junit.Assert.fail("Should have thrown");
531+
fail("Should have thrown");
531532
} catch (RuntimeException e) {
532533
assertThat(e).isSameInstanceAs(error);
533534
}
@@ -539,7 +540,7 @@ public Void answer(InvocationOnMock invocation) {
539540
// If it is passThrough, it will forward to the listener, which we know throws.
540541
try {
541542
delayedListener.onReady();
542-
org.junit.Assert.fail("Should have thrown");
543+
fail("Should have thrown");
543544
} catch (RuntimeException e) {
544545
assertThat(e).isSameInstanceAs(error);
545546
}

0 commit comments

Comments
 (0)