Skip to content

Commit e24027f

Browse files
authored
Upgrade to JUnit5 (#2810)
1 parent d5bcbb6 commit e24027f

File tree

181 files changed

+3272
-2761
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+3272
-2761
lines changed

.github/workflows/build-version.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
java: [ '8', '11', '17']
15+
java: [ '8', '11', '17' ]
1616
architecture: [ 'x64' ]
1717
name: Build with JDK ${{ matrix.java }} on ${{ matrix.architecture }}
1818
steps:
1919
- uses: actions/checkout@v4
2020
- name: Setup JDK
2121
uses: actions/setup-java@v4
2222
with:
23-
distribution: 'adopt'
23+
distribution: 'temurin'
2424
java-version: ${{ matrix.java }}
2525
architecture: ${{ matrix.architecture }}
2626
cache: 'maven'

pom.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ We use these goals frequently to keep the dependencies and plugins up-to-date:
6969
<eclipse.lifecycle.mapping.version>1.0.0</eclipse.lifecycle.mapping.version>
7070
<java.version>1.8</java.version>
7171
<jmh.version>1.21</jmh.version>
72-
<junit.version>4.13-beta-1</junit.version>
72+
<junit.version>5.11.0</junit.version>
7373
<maven.enforcer.version>3.0.0-M2</maven.enforcer.version>
7474
<maven.build-helper.version>3.0.0</maven.build-helper.version>
7575
<maven.bundle.version>5.1.1</maven.bundle.version>
@@ -93,9 +93,10 @@ We use these goals frequently to keep the dependencies and plugins up-to-date:
9393
<dependencyManagement>
9494
<dependencies>
9595
<dependency>
96-
<groupId>junit</groupId>
97-
<artifactId>junit</artifactId>
96+
<groupId>org.junit.jupiter</groupId>
97+
<artifactId>junit-jupiter</artifactId>
9898
<version>${junit.version}</version>
99+
<scope>test</scope>
99100
</dependency>
100101
<dependency>
101102
<groupId>org.assertj</groupId>

vavr-benchmark/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
<version>15.0</version>
6666
</dependency>
6767
<dependency>
68-
<groupId>junit</groupId>
69-
<artifactId>junit</artifactId>
68+
<groupId>org.junit.jupiter</groupId>
69+
<artifactId>junit-jupiter</artifactId>
7070
<scope>test</scope>
7171
</dependency>
7272
<dependency>

vavr-benchmark/src/test/java/io/vavr/collection/ArrayBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
package io.vavr.collection;
2121

2222
import io.vavr.JmhRunner;
23-
import org.junit.Test;
23+
import org.junit.jupiter.api.Test;
2424
import org.openjdk.jmh.annotations.*;
2525

2626
import java.util.ArrayList;

vavr-benchmark/src/test/java/io/vavr/collection/BitSetBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
package io.vavr.collection;
2121

2222
import io.vavr.JmhRunner;
23-
import org.junit.Test;
23+
import org.junit.jupiter.api.Test;
2424
import org.openjdk.jmh.annotations.*;
2525

2626
import static io.vavr.JmhRunner.create;

vavr-benchmark/src/test/java/io/vavr/collection/CharSeqBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
package io.vavr.collection;
2121

2222
import io.vavr.JmhRunner;
23-
import org.junit.Test;
23+
import org.junit.jupiter.api.Test;
2424
import org.openjdk.jmh.annotations.*;
2525

2626
import java.util.Objects;

vavr-benchmark/src/test/java/io/vavr/collection/HashSetBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
package io.vavr.collection;
2121

2222
import io.vavr.JmhRunner;
23-
import org.junit.Test;
23+
import org.junit.jupiter.api.Test;
2424
import org.openjdk.jmh.annotations.*;
2525

2626
import static io.vavr.JmhRunner.create;

vavr-benchmark/src/test/java/io/vavr/collection/IteratorBenchmark.java

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,34 @@
2020
package io.vavr.collection;
2121

2222
import io.vavr.JmhRunner;
23-
import org.junit.Assert;
24-
import org.junit.Test;
25-
import org.openjdk.jmh.annotations.*;
23+
import org.junit.jupiter.api.Assertions;
24+
import org.junit.jupiter.api.Test;
25+
import org.openjdk.jmh.annotations.Benchmark;
26+
import org.openjdk.jmh.annotations.Param;
27+
import org.openjdk.jmh.annotations.Scope;
28+
import org.openjdk.jmh.annotations.Setup;
29+
import org.openjdk.jmh.annotations.State;
2630
import org.openjdk.jmh.infra.Blackhole;
2731

2832
import java.util.Random;
2933

30-
import static io.vavr.JmhRunner.Includes.*;
34+
import static io.vavr.JmhRunner.Includes.JAVA;
35+
import static io.vavr.JmhRunner.Includes.SCALA;
36+
import static io.vavr.JmhRunner.Includes.VAVR;
3137
import static io.vavr.JmhRunner.getRandomValues;
3238

33-
@SuppressWarnings({ "ALL", "unchecked", "rawtypes" })
39+
@SuppressWarnings({"ALL", "unchecked", "rawtypes"})
3440
public class IteratorBenchmark {
3541

3642
static final Array<Class<?>> CLASSES = Array.of(
37-
Sliding.class,
38-
Concat.class
43+
Sliding.class,
44+
Concat.class
3945
);
4046

4147
@Test
42-
public void testAsserts() { JmhRunner.runDebugWithAsserts(CLASSES); }
48+
public void testAsserts() {
49+
JmhRunner.runDebugWithAsserts(CLASSES);
50+
}
4351

4452
public static void main(String... args) {
4553
JmhRunner.runDebugWithAsserts(CLASSES);
@@ -60,7 +68,8 @@ public static class Base {
6068
public void setup() {
6169
final Random random = new Random(0);
6270
ELEMENTS = getRandomValues(CONTAINER_SIZE, false, random);
63-
scalaIterator = (scala.collection.Iterator<Integer>) (Object) scala.collection.mutable.WrappedArray$.MODULE$.make(ELEMENTS).iterator();
71+
scalaIterator = (scala.collection.Iterator<Integer>) (Object) scala.collection.mutable.WrappedArray$.MODULE$.make(ELEMENTS)
72+
.iterator();
6473
vavrIterator = Iterator.of(ELEMENTS);
6574
}
6675
}
@@ -87,32 +96,32 @@ public void vavr_persistent(Blackhole bh) {
8796
@State(Scope.Benchmark)
8897
public static class Concat {
8998

90-
@Param({ "10", "20" , "100", "1000" })
99+
@Param({"10", "20", "100", "1000"})
91100
private int size;
92101

93102
@Benchmark
94103
public void vavr_persistent(Blackhole bh) {
95104
Iterator<Integer> iterator = Iterator.range(0, size)
96-
.foldLeft(Iterator.empty(), (result, __) -> result.concat(Iterator.of(1)));
105+
.foldLeft(Iterator.empty(), (result, __) -> result.concat(Iterator.of(1)));
97106

98107
long sum = 0;
99108
while (iterator.hasNext()) {
100109
sum += iterator.next();
101110
}
102-
Assert.assertEquals(size, sum);
111+
Assertions.assertEquals(size, sum);
103112
}
104113

105114
@Benchmark
106115
public void scala_persistent(Blackhole bh) {
107116
final scala.collection.Iterator<Integer> iterator = scala.collection.Iterator.range(0, size)
108-
.foldLeft((scala.collection.Iterator<Integer>) (Object) scala.collection.Iterator.empty(),
109-
(result, i) -> result.$plus$plus(() -> scala.collection.Iterator.single(1)));
110-
117+
.foldLeft((scala.collection.Iterator<Integer>) (Object) scala.collection.Iterator.empty(),
118+
(result, i) -> result.$plus$plus(() -> scala.collection.Iterator.single(1)));
119+
111120
long sum = 0;
112121
while (iterator.hasNext()) {
113122
sum += iterator.next();
114123
}
115-
Assert.assertEquals(size, sum);
124+
Assertions.assertEquals(size, sum);
116125
}
117126
}
118127
}

vavr-benchmark/src/test/java/io/vavr/collection/ListBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
package io.vavr.collection;
2121

2222
import io.vavr.JmhRunner;
23-
import org.junit.Test;
23+
import org.junit.jupiter.api.Test;
2424
import org.openjdk.jmh.annotations.*;
2525

2626
import java.util.ArrayList;

vavr-benchmark/src/test/java/io/vavr/collection/MapBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import io.vavr.Function1;
2323
import io.vavr.JmhRunner;
24-
import org.junit.Test;
24+
import org.junit.jupiter.api.Test;
2525
import org.openjdk.jmh.annotations.*;
2626
import org.openjdk.jmh.infra.Blackhole;
2727

0 commit comments

Comments
 (0)