Skip to content

Commit 44847bf

Browse files
authored
Upgrade JUnit to 4.13.2
ExpectedException is deprecated, so I fixed the new warnings. However, we are still using ExpectedException many places and had previously supressed the warning. See #7467 . I did not fix those existing instances that had suppressed the warning, since it is unrelated to the upgrade and we have been free to fix them at any time since we dropped Java 7.
1 parent 5a2c94b commit 44847bf

File tree

11 files changed

+35
-44
lines changed

11 files changed

+35
-44
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static com.google.common.base.Charsets.UTF_8;
2020
import static org.junit.Assert.assertArrayEquals;
2121
import static org.junit.Assert.assertEquals;
22+
import static org.junit.Assert.assertThrows;
2223
import static org.junit.Assert.assertTrue;
2324
import static org.mockito.ArgumentMatchers.anyInt;
2425
import static org.mockito.Mockito.mock;
@@ -32,9 +33,7 @@
3233
import java.io.IOException;
3334
import java.io.InputStream;
3435
import java.nio.InvalidMarkException;
35-
import org.junit.Rule;
3636
import org.junit.Test;
37-
import org.junit.rules.ExpectedException;
3837
import org.junit.runner.RunWith;
3938
import org.junit.runners.JUnit4;
4039

@@ -46,9 +45,6 @@
4645
public class ReadableBuffersTest {
4746
private static final byte[] MSG_BYTES = "hello".getBytes(UTF_8);
4847

49-
@Rule
50-
public final ExpectedException thrown = ExpectedException.none();
51-
5248
@Test
5349
public void empty_returnsEmptyBuffer() {
5450
ReadableBuffer buffer = ReadableBuffers.empty();
@@ -216,8 +212,7 @@ public void bufferInputStream_markDiscardedAfterDetached() throws IOException {
216212
InputStream inputStream = ReadableBuffers.openStream(buffer, true);
217213
inputStream.mark(5);
218214
((Detachable) inputStream).detach();
219-
thrown.expect(InvalidMarkException.class);
220-
inputStream.reset();
215+
assertThrows(InvalidMarkException.class, () -> inputStream.reset());
221216
}
222217

223218
@Test

examples/android/clientcache/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ dependencies {
5959
implementation 'io.grpc:grpc-stub:1.53.0-SNAPSHOT' // CURRENT_GRPC_VERSION
6060
implementation 'org.apache.tomcat:annotations-api:6.0.53'
6161

62-
testImplementation 'junit:junit:4.12'
62+
testImplementation 'junit:junit:4.13.2'
6363
testImplementation 'com.google.truth:truth:1.0.1'
6464
testImplementation 'io.grpc:grpc-testing:1.53.0-SNAPSHOT' // CURRENT_GRPC_VERSION
6565
}

examples/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies {
3636
runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
3737

3838
testImplementation "io.grpc:grpc-testing:${grpcVersion}"
39-
testImplementation "junit:junit:4.12"
39+
testImplementation "junit:junit:4.13.2"
4040
testImplementation "org.mockito:mockito-core:3.4.0"
4141
}
4242

examples/example-gauth/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<dependency>
7474
<groupId>junit</groupId>
7575
<artifactId>junit</artifactId>
76-
<version>4.12</version>
76+
<version>4.13.2</version>
7777
<scope>test</scope>
7878
</dependency>
7979
<dependency>

examples/example-hostname/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies {
3131
compileOnly "org.apache.tomcat:annotations-api:6.0.53"
3232
runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
3333

34-
testImplementation 'junit:junit:4.12'
34+
testImplementation 'junit:junit:4.13.2'
3535
testImplementation "io.grpc:grpc-testing:${grpcVersion}"
3636
}
3737

examples/example-hostname/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<dependency>
5959
<groupId>junit</groupId>
6060
<artifactId>junit</artifactId>
61-
<version>4.12</version>
61+
<version>4.13.2</version>
6262
<scope>test</scope>
6363
</dependency>
6464
<dependency>

examples/example-jwt-auth/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dependencies {
3737
runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
3838

3939
testImplementation "io.grpc:grpc-testing:${grpcVersion}"
40-
testImplementation "junit:junit:4.12"
40+
testImplementation "junit:junit:4.13.2"
4141
testImplementation "org.mockito:mockito-core:3.4.0"
4242
}
4343

examples/example-jwt-auth/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<dependency>
7272
<groupId>junit</groupId>
7373
<artifactId>junit</artifactId>
74-
<version>4.12</version>
74+
<version>4.13.2</version>
7575
<scope>test</scope>
7676
</dependency>
7777
<dependency>

examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<dependency>
7171
<groupId>junit</groupId>
7272
<artifactId>junit</artifactId>
73-
<version>4.12</version>
73+
<version>4.13.2</version>
7474
<scope>test</scope>
7575
</dependency>
7676
<dependency>

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ hdrhistogram = "org.hdrhistogram:HdrHistogram:2.1.12"
3939
javax-annotation = "org.apache.tomcat:annotations-api:6.0.53"
4040
jetty-alpn-agent = "org.mortbay.jetty.alpn:jetty-alpn-agent:2.0.10"
4141
jsr305 = "com.google.code.findbugs:jsr305:3.0.2"
42-
junit = "junit:junit:4.12"
42+
junit = "junit:junit:4.13.2"
4343
mockito-android = "org.mockito:mockito-android:3.8.0"
4444
mockito-core = "org.mockito:mockito-core:3.3.3"
4545
netty-codec-http2 = { module = "io.netty:netty-codec-http2", version.ref = "netty" }

0 commit comments

Comments
 (0)