Skip to content

Commit 074736e

Browse files
nebhalerobertroeser
authored andcommitted
Introduce JUnit 5 (#478)
This change introduces JUnit 5 to the build. It enables JUnit 5 support in Gradle and adds the required dependencies to write JUnit 5 types. The change does not remove the JUnit 4 dependencies yet, as the tests have not been converted.
1 parent 043e28b commit 074736e

File tree

8 files changed

+51
-8
lines changed

8 files changed

+51
-8
lines changed

build.gradle

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,24 @@ subprojects {
4343
dependency 'com.google.code.findbugs:jsr305:3.0.2'
4444
dependency 'com.netflix.spectator:spectator-api:0.63.0'
4545
dependency 'io.netty:netty-buffer:4.1.21.Final'
46-
dependency 'junit:junit:4.12'
4746
dependency 'io.aeron:aeron-all:1.4.1'
4847
dependency 'org.hamcrest:hamcrest-library:1.3'
4948
dependency 'org.hdrhistogram:HdrHistogram:2.1.10'
5049
dependency 'org.jctools:jctools-core:2.1.2'
5150
dependency 'org.mockito:mockito-core:2.16.0'
5251
dependency 'org.openjdk.jmh:jmh-core:1.20'
5352

53+
dependencySet(group: 'org.junit.jupiter', version: '5.1.0') {
54+
entry 'junit-jupiter-api'
55+
entry 'junit-jupiter-engine'
56+
}
57+
58+
// TODO: Remove after JUnit5 migration
59+
dependency 'junit:junit:4.12'
60+
dependencySet(group: 'org.junit.vintage', version: '5.1.0') {
61+
entry 'junit-vintage-engine'
62+
}
63+
5464
dependencySet(group: 'org.openjdk.jmh', version: '1.20') {
5565
entry 'jmh-core'
5666
entry 'jmh-generator-annprocess'
@@ -74,6 +84,10 @@ subprojects {
7484
// TODO: Cleanup warnings so no need to exclude
7585
options.compilerArgs << '-Xlint:all,-overloads,-rawtypes,-unchecked'
7686
}
87+
88+
test {
89+
useJUnitPlatform()
90+
}
7791
}
7892

7993
plugins.withType(JavaLibraryPlugin) {

rsocket-core/build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,15 @@ dependencies {
3333
implementation 'org.slf4j:slf4j-api'
3434

3535
testImplementation 'io.projectreactor:reactor-test'
36-
testImplementation 'junit:junit'
3736
testImplementation 'org.hamcrest:hamcrest-library'
37+
testImplementation 'org.junit.jupiter:junit-jupiter-api'
3838
testImplementation 'org.mockito:mockito-core'
39+
40+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
41+
42+
// TODO: Remove after JUnit5 migration
43+
testCompileOnly 'junit:junit'
44+
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
3945
}
4046

4147
jar {

rsocket-examples/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ dependencies {
2424
compile project(':rsocket-transport-netty')
2525

2626
testCompile project(':rsocket-test')
27-
testCompile 'junit:junit'
2827
testCompile 'org.hamcrest:hamcrest-library'
28+
testCompile 'org.junit.jupiter:junit-jupiter-api'
2929
testCompile 'org.mockito:mockito-core'
30+
31+
// TODO: Remove after JUnit5 migration
32+
testCompileOnly 'junit:junit'
33+
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
3034
}
3135

3236
description = 'Example usage of the RSocket library'

rsocket-load-balancer/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ dependencies {
2626
implementation 'org.slf4j:slf4j-api'
2727

2828
testImplementation project(':rsocket-test')
29-
testImplementation 'junit:junit'
3029
testImplementation 'org.hamcrest:hamcrest-library'
30+
testImplementation 'org.junit.jupiter:junit-jupiter-api'
3131
testImplementation 'org.mockito:mockito-core'
32+
33+
// TODO: Remove after JUnit5 migration
34+
testCompileOnly 'junit:junit'
35+
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
3236
}
3337

3438
description = 'Transparent Load Balancer for RSocket'

rsocket-test/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ dependencies {
2222
api 'org.hdrhistogram:HdrHistogram'
2323

2424
implementation project(':rsocket-core')
25-
implementation 'junit:junit'
25+
implementation 'org.junit.jupiter:junit-jupiter-api'
2626
implementation 'org.mockito:mockito-core'
27+
28+
// TODO: Remove after JUnit5 migration
29+
implementation 'junit:junit'
2730
}
2831

2932
description = 'Test utilities for RSocket projects'

rsocket-transport-aeron/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ dependencies {
2828
implementation 'org.slf4j:slf4j-api'
2929

3030
testImplementation project(':rsocket-test')
31-
testImplementation 'junit:junit'
31+
testImplementation 'org.junit.jupiter:junit-jupiter-api'
32+
33+
// TODO: Remove after JUnit5 migration
34+
testCompileOnly 'junit:junit'
35+
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
3236
}
3337

3438
description = 'Aeron RSocket transport implementation'

rsocket-transport-local/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ dependencies {
2525
implementation project(':rsocket-core')
2626

2727
testImplementation project(':rsocket-test')
28-
testImplementation 'junit:junit'
28+
testImplementation 'org.junit.jupiter:junit-jupiter-api'
29+
30+
// TODO: Remove after JUnit5 migration
31+
testCompileOnly 'junit:junit'
32+
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
2933
}
3034

3135
description = 'Local RSocket transport implementation'

rsocket-transport-netty/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ dependencies {
2727
implementation project(':rsocket-core')
2828

2929
testImplementation project(':rsocket-test')
30-
testImplementation 'junit:junit'
30+
testImplementation 'org.junit.jupiter:junit-jupiter-api'
31+
32+
// TODO: Remove after JUnit5 migration
33+
testCompileOnly 'junit:junit'
34+
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
3135
}
3236

3337
description = 'Reactor Netty RSocket transport implementations (TCP, Websocket)'

0 commit comments

Comments
 (0)