From eda96e6f9104a6ef2eb0a06c6806d5b5130946ff Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Wed, 11 Sep 2024 07:34:27 +0200 Subject: [PATCH] Upgrade to JUnit5 --- pom.xml | 7 +- vavr-benchmark/pom.xml | 4 +- .../io/vavr/collection/ArrayBenchmark.java | 2 +- .../io/vavr/collection/BitSetBenchmark.java | 2 +- .../io/vavr/collection/CharSeqBenchmark.java | 2 +- .../io/vavr/collection/HashSetBenchmark.java | 2 +- .../io/vavr/collection/IteratorBenchmark.java | 2 +- .../io/vavr/collection/ListBenchmark.java | 2 +- .../java/io/vavr/collection/MapBenchmark.java | 2 +- .../collection/PriorityQueueBenchmark.java | 2 +- .../io/vavr/collection/VectorBenchmark.java | 2 +- .../java/io/vavr/control/LazyBenchmark.java | 2 +- .../test/java/io/vavr/idiom/ForBenchmark.java | 2 +- .../vavr/idiom/PatternMatchingBenchmark.java | 2 +- .../test/java/io/vavr/idiom/TryBenchmark.java | 2 +- .../java/io/vavr/idiom/TupleBenchmark.java | 2 +- vavr-match-processor/pom.xml | 4 +- vavr-test/generator/Generator.scala | 4 +- vavr-test/pom.xml | 4 +- .../java/io/vavr/test/PropertyCheck1Test.java | 4 +- .../java/io/vavr/test/PropertyCheck2Test.java | 4 +- .../java/io/vavr/test/PropertyCheck3Test.java | 4 +- .../java/io/vavr/test/PropertyCheck4Test.java | 4 +- .../java/io/vavr/test/PropertyCheck5Test.java | 4 +- .../java/io/vavr/test/PropertyCheck6Test.java | 4 +- .../java/io/vavr/test/PropertyCheck7Test.java | 4 +- .../java/io/vavr/test/PropertyCheck8Test.java | 4 +- .../test/java/io/vavr/test/PropertyTest.java | 4 +- .../test/java/io/vavr/test/ArbitraryTest.java | 2 +- .../java/io/vavr/test/CheckResultTest.java | 2 +- .../test/java/io/vavr/test/ConditionTest.java | 2 +- .../src/test/java/io/vavr/test/GenTest.java | 2 +- vavr/generator/Generator.scala | 32 +- vavr/pom.xml | 4 +- vavr/src-gen/main/java/io/vavr/API.java | 2 +- vavr/src-gen/test/java/io/vavr/APITest.java | 5 +- .../java/io/vavr/CheckedFunction0Test.java | 13 +- .../java/io/vavr/CheckedFunction1Test.java | 11 +- .../java/io/vavr/CheckedFunction2Test.java | 11 +- .../java/io/vavr/CheckedFunction3Test.java | 11 +- .../java/io/vavr/CheckedFunction4Test.java | 11 +- .../java/io/vavr/CheckedFunction5Test.java | 11 +- .../java/io/vavr/CheckedFunction6Test.java | 11 +- .../java/io/vavr/CheckedFunction7Test.java | 11 +- .../java/io/vavr/CheckedFunction8Test.java | 11 +- .../test/java/io/vavr/Function0Test.java | 3 +- .../test/java/io/vavr/Function1Test.java | 3 +- .../test/java/io/vavr/Function2Test.java | 3 +- .../test/java/io/vavr/Function3Test.java | 3 +- .../test/java/io/vavr/Function4Test.java | 3 +- .../test/java/io/vavr/Function5Test.java | 3 +- .../test/java/io/vavr/Function6Test.java | 3 +- .../test/java/io/vavr/Function7Test.java | 3 +- .../test/java/io/vavr/Function8Test.java | 3 +- .../src-gen/test/java/io/vavr/Tuple0Test.java | 3 +- .../src-gen/test/java/io/vavr/Tuple1Test.java | 3 +- .../src-gen/test/java/io/vavr/Tuple2Test.java | 3 +- .../src-gen/test/java/io/vavr/Tuple3Test.java | 3 +- .../src-gen/test/java/io/vavr/Tuple4Test.java | 3 +- .../src-gen/test/java/io/vavr/Tuple5Test.java | 3 +- .../src-gen/test/java/io/vavr/Tuple6Test.java | 3 +- .../src-gen/test/java/io/vavr/Tuple7Test.java | 3 +- .../src-gen/test/java/io/vavr/Tuple8Test.java | 3 +- .../vavr/collection/HashMapOfEntriesTest.java | 3 +- .../collection/HashMultimapOfEntriesTest.java | 3 +- .../LinkedHashMapOfEntriesTest.java | 3 +- .../LinkedHashMultimapOfEntriesTest.java | 3 +- .../vavr/collection/TreeMapOfEntriesTest.java | 3 +- .../collection/TreeMultimapOfEntriesTest.java | 3 +- .../test/java/io/vavr/AbstractValueTest.java | 3 +- .../java/io/vavr/CheckedConsumerTest.java | 2 +- .../java/io/vavr/CheckedPredicateTest.java | 2 +- .../java/io/vavr/CheckedRunnableTest.java | 2 +- vavr/src/test/java/io/vavr/IterableTest.java | 2 +- vavr/src/test/java/io/vavr/LazyTest.java | 2 +- .../src/test/java/io/vavr/MatchErrorTest.java | 2 +- vavr/src/test/java/io/vavr/MatchTest.java | 2 +- vavr/src/test/java/io/vavr/OutputTester.java | 2 +- .../java/io/vavr/PartialFunctionTest.java | 2 +- .../src/test/java/io/vavr/PredicatesTest.java | 2 +- vavr/src/test/java/io/vavr/TupleTest.java | 2 +- vavr/src/test/java/io/vavr/ValueTest.java | 2 +- .../collection/AbstractIndexedSeqTest.java | 2 +- .../collection/AbstractLinearSeqTest.java | 2 +- .../io/vavr/collection/AbstractMapTest.java | 2 +- .../vavr/collection/AbstractMultimapTest.java | 522 ++++++++++-------- .../io/vavr/collection/AbstractSeqTest.java | 2 +- .../io/vavr/collection/AbstractSetTest.java | 2 +- .../collection/AbstractSortedMapTest.java | 2 +- .../collection/AbstractSortedSetTest.java | 2 +- .../AbstractTraversableRangeTest.java | 2 +- .../collection/AbstractTraversableTest.java | 448 ++++++++------- .../java/io/vavr/collection/ArrayTest.java | 2 +- .../java/io/vavr/collection/BitSetTest.java | 2 +- .../java/io/vavr/collection/CharSeqTest.java | 2 +- .../io/vavr/collection/CollectionsTest.java | 2 +- .../io/vavr/collection/ComparatorsTest.java | 2 +- .../collection/HashArrayMappedTrieTest.java | 2 +- .../java/io/vavr/collection/HashMapTest.java | 2 +- .../io/vavr/collection/HashMultimapTest.java | 2 +- .../java/io/vavr/collection/HashSetTest.java | 2 +- .../java/io/vavr/collection/IntMod2Test.java | 2 +- .../java/io/vavr/collection/IteratorTest.java | 2 +- .../vavr/collection/JavaConvertersTest.java | 2 +- .../io/vavr/collection/LinkedHashMapTest.java | 2 +- .../collection/LinkedHashMultimapTest.java | 2 +- .../io/vavr/collection/LinkedHashSetTest.java | 2 +- .../java/io/vavr/collection/ListTest.java | 2 +- .../io/vavr/collection/PriorityQueueTest.java | 2 +- .../java/io/vavr/collection/QueueTest.java | 2 +- .../io/vavr/collection/QuickSortTest.java | 2 +- .../io/vavr/collection/RedBlackTreeTest.java | 2 +- .../java/io/vavr/collection/StreamTest.java | 2 +- .../java/io/vavr/collection/StringTest.java | 2 +- .../java/io/vavr/collection/TreeMapTest.java | 2 +- .../io/vavr/collection/TreeMultimapTest.java | 2 +- .../java/io/vavr/collection/TreeSetTest.java | 2 +- .../java/io/vavr/collection/TreeTest.java | 2 +- .../vavr/collection/VectorPropertyTest.java | 2 +- .../java/io/vavr/collection/VectorTest.java | 2 +- .../io/vavr/collection/euler/Euler01Test.java | 2 +- .../io/vavr/collection/euler/Euler02Test.java | 2 +- .../io/vavr/collection/euler/Euler03Test.java | 2 +- .../io/vavr/collection/euler/Euler04Test.java | 2 +- .../io/vavr/collection/euler/Euler05Test.java | 2 +- .../io/vavr/collection/euler/Euler06Test.java | 2 +- .../io/vavr/collection/euler/Euler07Test.java | 2 +- .../io/vavr/collection/euler/Euler08Test.java | 2 +- .../io/vavr/collection/euler/Euler09Test.java | 2 +- .../io/vavr/collection/euler/Euler10Test.java | 2 +- .../io/vavr/collection/euler/Euler11Test.java | 2 +- .../io/vavr/collection/euler/Euler12Test.java | 2 +- .../io/vavr/collection/euler/Euler13Test.java | 2 +- .../io/vavr/collection/euler/Euler14Test.java | 2 +- .../io/vavr/collection/euler/Euler15Test.java | 2 +- .../io/vavr/collection/euler/Euler16Test.java | 2 +- .../io/vavr/collection/euler/Euler17Test.java | 2 +- .../io/vavr/collection/euler/Euler18Test.java | 2 +- .../io/vavr/collection/euler/Euler19Test.java | 2 +- .../io/vavr/collection/euler/Euler20Test.java | 2 +- .../io/vavr/collection/euler/Euler21Test.java | 2 +- .../io/vavr/collection/euler/Euler22Test.java | 2 +- .../io/vavr/collection/euler/Euler23Test.java | 2 +- .../io/vavr/collection/euler/Euler24Test.java | 2 +- .../io/vavr/collection/euler/Euler25Test.java | 2 +- .../io/vavr/collection/euler/Euler26Test.java | 2 +- .../io/vavr/collection/euler/Euler27Test.java | 2 +- .../io/vavr/collection/euler/Euler28Test.java | 2 +- .../io/vavr/collection/euler/Euler29Test.java | 2 +- .../io/vavr/collection/euler/Euler30Test.java | 2 +- .../io/vavr/collection/euler/Euler31Test.java | 2 +- .../io/vavr/collection/euler/Euler32Test.java | 2 +- .../io/vavr/collection/euler/Euler33Test.java | 2 +- .../io/vavr/collection/euler/Euler34Test.java | 2 +- .../io/vavr/collection/euler/Euler35Test.java | 2 +- .../io/vavr/collection/euler/Euler36Test.java | 2 +- .../io/vavr/collection/euler/Euler37Test.java | 2 +- .../io/vavr/collection/euler/Euler38Test.java | 2 +- .../io/vavr/collection/euler/Euler39Test.java | 2 +- .../io/vavr/collection/euler/Euler40Test.java | 2 +- .../io/vavr/collection/euler/Euler41Test.java | 2 +- .../io/vavr/collection/euler/Euler42Test.java | 2 +- .../io/vavr/collection/euler/Euler43Test.java | 2 +- .../io/vavr/collection/euler/Euler45Test.java | 2 +- .../io/vavr/collection/euler/Euler48Test.java | 2 +- .../io/vavr/collection/euler/Euler55Test.java | 2 +- .../io/vavr/collection/euler/Euler57Test.java | 2 +- .../io/vavr/collection/euler/Euler67Test.java | 2 +- .../io/vavr/collection/euler/Euler71Test.java | 2 +- .../io/vavr/collection/euler/Euler99Test.java | 2 +- .../java/io/vavr/concurrent/FutureTest.java | 2 +- .../java/io/vavr/concurrent/PromiseTest.java | 2 +- .../control/EitherLeftProjectionTest.java | 2 +- .../control/EitherRightProjectionTest.java | 2 +- .../test/java/io/vavr/control/EitherTest.java | 2 +- .../test/java/io/vavr/control/OptionTest.java | 2 +- .../test/java/io/vavr/control/TryTest.java | 2 +- .../java/io/vavr/control/ValidationTest.java | 2 +- .../java/io/vavr/issues/Issue2559Test.java | 2 +- .../IllegalAccessErrorTest.java | 2 +- 180 files changed, 833 insertions(+), 667 deletions(-) diff --git a/pom.xml b/pom.xml index 7847732594..7a793f5e18 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ We use these goals frequently to keep the dependencies and plugins up-to-date: 1.0.0 1.8 1.21 - 4.13-beta-1 + 5.11.0 3.0.0-M2 3.0.0 5.1.1 @@ -93,9 +93,10 @@ We use these goals frequently to keep the dependencies and plugins up-to-date: - junit - junit + org.junit.jupiter + junit-jupiter ${junit.version} + test org.assertj diff --git a/vavr-benchmark/pom.xml b/vavr-benchmark/pom.xml index 2f3bdcdd2e..e7b24a1627 100644 --- a/vavr-benchmark/pom.xml +++ b/vavr-benchmark/pom.xml @@ -65,8 +65,8 @@ 15.0 - junit - junit + org.junit.jupiter + junit-jupiter test diff --git a/vavr-benchmark/src/test/java/io/vavr/collection/ArrayBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/collection/ArrayBenchmark.java index be7a5b960d..e776e09af1 100644 --- a/vavr-benchmark/src/test/java/io/vavr/collection/ArrayBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/collection/ArrayBenchmark.java @@ -20,7 +20,7 @@ package io.vavr.collection; import io.vavr.JmhRunner; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.*; import java.util.ArrayList; diff --git a/vavr-benchmark/src/test/java/io/vavr/collection/BitSetBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/collection/BitSetBenchmark.java index 35c7b21710..2918dc4783 100644 --- a/vavr-benchmark/src/test/java/io/vavr/collection/BitSetBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/collection/BitSetBenchmark.java @@ -20,7 +20,7 @@ package io.vavr.collection; import io.vavr.JmhRunner; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.*; import static io.vavr.JmhRunner.create; diff --git a/vavr-benchmark/src/test/java/io/vavr/collection/CharSeqBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/collection/CharSeqBenchmark.java index 33549e3eec..9b706b962b 100644 --- a/vavr-benchmark/src/test/java/io/vavr/collection/CharSeqBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/collection/CharSeqBenchmark.java @@ -20,7 +20,7 @@ package io.vavr.collection; import io.vavr.JmhRunner; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.*; import java.util.Objects; diff --git a/vavr-benchmark/src/test/java/io/vavr/collection/HashSetBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/collection/HashSetBenchmark.java index f7fb4fa40c..0320862db4 100644 --- a/vavr-benchmark/src/test/java/io/vavr/collection/HashSetBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/collection/HashSetBenchmark.java @@ -20,7 +20,7 @@ package io.vavr.collection; import io.vavr.JmhRunner; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.*; import static io.vavr.JmhRunner.create; diff --git a/vavr-benchmark/src/test/java/io/vavr/collection/IteratorBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/collection/IteratorBenchmark.java index 2ee3266d74..3f77e5cae3 100644 --- a/vavr-benchmark/src/test/java/io/vavr/collection/IteratorBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/collection/IteratorBenchmark.java @@ -21,7 +21,7 @@ import io.vavr.JmhRunner; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; diff --git a/vavr-benchmark/src/test/java/io/vavr/collection/ListBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/collection/ListBenchmark.java index af2ddff6e6..26c5ab92ac 100644 --- a/vavr-benchmark/src/test/java/io/vavr/collection/ListBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/collection/ListBenchmark.java @@ -20,7 +20,7 @@ package io.vavr.collection; import io.vavr.JmhRunner; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.*; import java.util.ArrayList; diff --git a/vavr-benchmark/src/test/java/io/vavr/collection/MapBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/collection/MapBenchmark.java index 694dd9d805..8e977927f9 100644 --- a/vavr-benchmark/src/test/java/io/vavr/collection/MapBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/collection/MapBenchmark.java @@ -21,7 +21,7 @@ import io.vavr.Function1; import io.vavr.JmhRunner; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; diff --git a/vavr-benchmark/src/test/java/io/vavr/collection/PriorityQueueBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/collection/PriorityQueueBenchmark.java index a88f053b15..41c4d05e15 100644 --- a/vavr-benchmark/src/test/java/io/vavr/collection/PriorityQueueBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/collection/PriorityQueueBenchmark.java @@ -22,7 +22,7 @@ import fj.P; import io.vavr.JmhRunner; import io.vavr.Tuple2; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.*; import scala.math.Ordering; import scala.math.Ordering$; diff --git a/vavr-benchmark/src/test/java/io/vavr/collection/VectorBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/collection/VectorBenchmark.java index 827f045574..d60b6d3cbe 100644 --- a/vavr-benchmark/src/test/java/io/vavr/collection/VectorBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/collection/VectorBenchmark.java @@ -20,7 +20,7 @@ package io.vavr.collection; import io.vavr.JmhRunner; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; import scala.collection.generic.CanBuildFrom; diff --git a/vavr-benchmark/src/test/java/io/vavr/control/LazyBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/control/LazyBenchmark.java index c1830ddf9a..105a2cc378 100644 --- a/vavr-benchmark/src/test/java/io/vavr/control/LazyBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/control/LazyBenchmark.java @@ -23,7 +23,7 @@ import io.vavr.Lazy; import io.vavr.collection.Array; import io.vavr.collection.Iterator; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; diff --git a/vavr-benchmark/src/test/java/io/vavr/idiom/ForBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/idiom/ForBenchmark.java index 99b7dcf390..a7832ddf9d 100644 --- a/vavr-benchmark/src/test/java/io/vavr/idiom/ForBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/idiom/ForBenchmark.java @@ -21,7 +21,7 @@ import io.vavr.JmhRunner; import io.vavr.collection.Array; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; diff --git a/vavr-benchmark/src/test/java/io/vavr/idiom/PatternMatchingBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/idiom/PatternMatchingBenchmark.java index 9c339a30da..52fd5b2e32 100644 --- a/vavr-benchmark/src/test/java/io/vavr/idiom/PatternMatchingBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/idiom/PatternMatchingBenchmark.java @@ -21,7 +21,7 @@ import io.vavr.JmhRunner; import io.vavr.collection.Array; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; diff --git a/vavr-benchmark/src/test/java/io/vavr/idiom/TryBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/idiom/TryBenchmark.java index 713e842958..2835efbc9a 100644 --- a/vavr-benchmark/src/test/java/io/vavr/idiom/TryBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/idiom/TryBenchmark.java @@ -21,7 +21,7 @@ import io.vavr.JmhRunner; import io.vavr.collection.Array; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; diff --git a/vavr-benchmark/src/test/java/io/vavr/idiom/TupleBenchmark.java b/vavr-benchmark/src/test/java/io/vavr/idiom/TupleBenchmark.java index cf5fe795d6..df66b16756 100644 --- a/vavr-benchmark/src/test/java/io/vavr/idiom/TupleBenchmark.java +++ b/vavr-benchmark/src/test/java/io/vavr/idiom/TupleBenchmark.java @@ -22,7 +22,7 @@ import io.vavr.JmhRunner; import io.vavr.Tuple; import io.vavr.collection.Array; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; diff --git a/vavr-match-processor/pom.xml b/vavr-match-processor/pom.xml index f57bc91a53..4c0900ce9c 100644 --- a/vavr-match-processor/pom.xml +++ b/vavr-match-processor/pom.xml @@ -26,8 +26,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter test diff --git a/vavr-test/generator/Generator.scala b/vavr-test/generator/Generator.scala index 235f133e37..9fb0d13073 100644 --- a/vavr-test/generator/Generator.scala +++ b/vavr-test/generator/Generator.scala @@ -351,7 +351,7 @@ def generateTestClasses(): Unit = { val tuple = im.getType("io.vavr.Tuple") // test classes - val test = im.getType("org.junit.Test") + val test = im.getType("org.junit.jupiter.api.Test") val assertThat = im.getStatic("org.assertj.core.api.Assertions.assertThat") val woops = "yay! (this is a negative test)" @@ -577,7 +577,7 @@ def generateTestClasses(): Unit = { val args = (1 to i).gen(j => s"o$j")(", ") // test classes - val test = im.getType("org.junit.Test") + val test = im.getType("org.junit.jupiter.api.Test") val assertThat = im.getStatic("org.assertj.core.api.Assertions.assertThat") val woops = "yay! (this is a negative test)" diff --git a/vavr-test/pom.xml b/vavr-test/pom.xml index 2508903683..ab5988cb37 100644 --- a/vavr-test/pom.xml +++ b/vavr-test/pom.xml @@ -25,8 +25,8 @@ ${project.version} - junit - junit + org.junit.jupiter + junit-jupiter test diff --git a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck1Test.java b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck1Test.java index e716d3db41..fda30fc8ef 100644 --- a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck1Test.java +++ b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck1Test.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; import io.vavr.CheckedFunction1; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PropertyCheck1Test { @@ -118,4 +118,4 @@ public void shouldReturnErroneousProperty1CheckResultIfArbitraryFails() { .check(); assertThat(result.isErroneous()).isTrue(); } -} \ No newline at end of file +} diff --git a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck2Test.java b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck2Test.java index 0d183a9d4a..b6aa447b07 100644 --- a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck2Test.java +++ b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck2Test.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; import io.vavr.CheckedFunction2; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PropertyCheck2Test { @@ -118,4 +118,4 @@ public void shouldReturnErroneousProperty2CheckResultIfArbitraryFails() { .check(); assertThat(result.isErroneous()).isTrue(); } -} \ No newline at end of file +} diff --git a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck3Test.java b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck3Test.java index 285b2040f7..47095db6c3 100644 --- a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck3Test.java +++ b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck3Test.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; import io.vavr.CheckedFunction3; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PropertyCheck3Test { @@ -118,4 +118,4 @@ public void shouldReturnErroneousProperty3CheckResultIfArbitraryFails() { .check(); assertThat(result.isErroneous()).isTrue(); } -} \ No newline at end of file +} diff --git a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck4Test.java b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck4Test.java index 5115a88eef..d9b11949e5 100644 --- a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck4Test.java +++ b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck4Test.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; import io.vavr.CheckedFunction4; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PropertyCheck4Test { @@ -118,4 +118,4 @@ public void shouldReturnErroneousProperty4CheckResultIfArbitraryFails() { .check(); assertThat(result.isErroneous()).isTrue(); } -} \ No newline at end of file +} diff --git a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck5Test.java b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck5Test.java index 5cecd7982e..bc649bd2c4 100644 --- a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck5Test.java +++ b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck5Test.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; import io.vavr.CheckedFunction5; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PropertyCheck5Test { @@ -118,4 +118,4 @@ public void shouldReturnErroneousProperty5CheckResultIfArbitraryFails() { .check(); assertThat(result.isErroneous()).isTrue(); } -} \ No newline at end of file +} diff --git a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck6Test.java b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck6Test.java index 42f0743700..7c48e9a60e 100644 --- a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck6Test.java +++ b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck6Test.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; import io.vavr.CheckedFunction6; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PropertyCheck6Test { @@ -118,4 +118,4 @@ public void shouldReturnErroneousProperty6CheckResultIfArbitraryFails() { .check(); assertThat(result.isErroneous()).isTrue(); } -} \ No newline at end of file +} diff --git a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck7Test.java b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck7Test.java index 3f8e8e3f68..e6afc98faa 100644 --- a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck7Test.java +++ b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck7Test.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; import io.vavr.CheckedFunction7; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PropertyCheck7Test { @@ -118,4 +118,4 @@ public void shouldReturnErroneousProperty7CheckResultIfArbitraryFails() { .check(); assertThat(result.isErroneous()).isTrue(); } -} \ No newline at end of file +} diff --git a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck8Test.java b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck8Test.java index a94132ca61..1513c70267 100644 --- a/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck8Test.java +++ b/vavr-test/src-gen/test/java/io/vavr/test/PropertyCheck8Test.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; import io.vavr.CheckedFunction8; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PropertyCheck8Test { @@ -118,4 +118,4 @@ public void shouldReturnErroneousProperty8CheckResultIfArbitraryFails() { .check(); assertThat(result.isErroneous()).isTrue(); } -} \ No newline at end of file +} diff --git a/vavr-test/src-gen/test/java/io/vavr/test/PropertyTest.java b/vavr-test/src-gen/test/java/io/vavr/test/PropertyTest.java index 3939fdae80..5bf8d3e7a0 100644 --- a/vavr-test/src-gen/test/java/io/vavr/test/PropertyTest.java +++ b/vavr-test/src-gen/test/java/io/vavr/test/PropertyTest.java @@ -29,7 +29,7 @@ import io.vavr.Tuple; import io.vavr.collection.List; import java.util.Random; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PropertyTest { @@ -239,4 +239,4 @@ public void shouldCheckOrCombinationWhereFirstPropertyIsFalseAndSecondPropertyIs final CheckResult result = p1.or(p2).check(); assertThat(result.isSatisfied()).isFalse(); } -} \ No newline at end of file +} diff --git a/vavr-test/src/test/java/io/vavr/test/ArbitraryTest.java b/vavr-test/src/test/java/io/vavr/test/ArbitraryTest.java index 94690761f5..fa10dbb092 100644 --- a/vavr-test/src/test/java/io/vavr/test/ArbitraryTest.java +++ b/vavr-test/src/test/java/io/vavr/test/ArbitraryTest.java @@ -24,7 +24,7 @@ import io.vavr.collection.Iterator; import io.vavr.collection.List; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; diff --git a/vavr-test/src/test/java/io/vavr/test/CheckResultTest.java b/vavr-test/src/test/java/io/vavr/test/CheckResultTest.java index 388f2880fd..fcacfe8578 100644 --- a/vavr-test/src/test/java/io/vavr/test/CheckResultTest.java +++ b/vavr-test/src/test/java/io/vavr/test/CheckResultTest.java @@ -22,7 +22,7 @@ import io.vavr.Tuple; import io.vavr.control.Option; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Objects; diff --git a/vavr-test/src/test/java/io/vavr/test/ConditionTest.java b/vavr-test/src/test/java/io/vavr/test/ConditionTest.java index df4537f148..b7c5aed7e2 100644 --- a/vavr-test/src/test/java/io/vavr/test/ConditionTest.java +++ b/vavr-test/src/test/java/io/vavr/test/ConditionTest.java @@ -20,7 +20,7 @@ package io.vavr.test; import io.vavr.test.Property.Condition; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr-test/src/test/java/io/vavr/test/GenTest.java b/vavr-test/src/test/java/io/vavr/test/GenTest.java index cd4c915b94..cb467b82e7 100644 --- a/vavr-test/src/test/java/io/vavr/test/GenTest.java +++ b/vavr-test/src/test/java/io/vavr/test/GenTest.java @@ -23,7 +23,7 @@ import io.vavr.collection.Stream; import io.vavr.Tuple2; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.Random; diff --git a/vavr/generator/Generator.scala b/vavr/generator/Generator.scala index 2c203a7366..663f35861a 100644 --- a/vavr/generator/Generator.scala +++ b/vavr/generator/Generator.scala @@ -2602,7 +2602,8 @@ def generateTestClasses(): Unit = { genVavrFile("io.vavr", s"APITest", baseDir = TARGET_TEST)((im: ImportManager, packageName, className) => { val assertThat = im.getStatic("org.assertj.core.api.Assertions.assertThat") - val test = im.getType("org.junit.Test") + val test = im.getType("org.junit.jupiter.api.Test") + val assertThrows = im.getStatic("org.junit.jupiter.api.Assertions.assertThrows") val API = im.getType("io.vavr.API") val AssertionsExtensions = im.getType("io.vavr.AssertionsExtensions") @@ -2817,7 +2818,7 @@ def generateTestClasses(): Unit = { def genShortcutsTests(im: ImportManager, packageName: String, className: String): String = { - val fail = im.getStatic("org.junit.Assert.fail") + val fail = im.getStatic("org.junit.jupiter.api.Assertions.fail") val captureStdOut = im.getStatic("io.vavr.OutputTester.captureStdOut") xs""" @@ -3058,8 +3059,9 @@ def generateTestClasses(): Unit = { val functionArgs = (1 to i).gen(j => s"o$j")(", ") val generics = (1 to i + 1).gen(j => "Object")(", ") - val test = im.getType("org.junit.Test") + val test = im.getType("org.junit.jupiter.api.Test") val assertThat = im.getStatic("org.assertj.core.api.Assertions.assertThat") + val assertThrows = im.getStatic("org.junit.jupiter.api.Assertions.assertThrows") val recFuncF1 = if (i == 0) "11;" else s"i1 <= 0 ? i1 : $className.recurrent2.apply(${(1 to i).gen(j => s"i$j" + (j == 1).gen(s" - 1"))(", ")}) + 1;" def curriedType(max: Int, function: String): String = max match { @@ -3283,11 +3285,13 @@ def generateTestClasses(): Unit = { assertThat(md5.getDigestLength()).isEqualTo(16); } - @$test(expected = ${im.getType("java.security.NoSuchAlgorithmException")}.class) + @$test public void shouldThrowCheckedExceptionWhenUnchecked() { - $name$i digest = () -> ${im.getType("java.security.MessageDigest")}.getInstance("Unknown"); - Function$i unchecked = digest.unchecked(); - unchecked.apply(); // Look ma, we throw an undeclared checked exception! + $assertThrows(${im.getType("java.security.NoSuchAlgorithmException")}.class, () -> { + $name$i digest = () -> ${im.getType("java.security.MessageDigest")}.getInstance("Unknown"); + Function$i unchecked = digest.unchecked(); + unchecked.apply(); // Look ma, we throw an undeclared checked exception! + }); } @$test @@ -3349,10 +3353,12 @@ def generateTestClasses(): Unit = { assertThat(md5.getDigestLength()).isEqualTo(16); } - @$test(expected = ${im.getType("java.security.NoSuchAlgorithmException")}.class) + @$test public void shouldUncheckedThrowIllegalState() { - final Function$i<${(1 to i).gen(j => "String")(", ")}, MessageDigest> unchecked = digest.unchecked(); - unchecked.apply(${toArgList("Unknown")}); // Look ma, we throw an undeclared checked exception! + $assertThrows(${im.getType("java.security.NoSuchAlgorithmException")}.class, () -> { + final Function$i<${(1 to i).gen(j => "String")(", ")}, MessageDigest> unchecked = digest.unchecked(); + unchecked.apply(${toArgList("Unknown")}); // Look ma, we throw an undeclared checked exception! + }); } @$test @@ -3432,8 +3438,9 @@ def generateTestClasses(): Unit = { def genAllArity(im: ImportManager, mapName: String, mapBuilder: String, builderComparator: Boolean, keyComparator: Boolean): String = { - val test = im.getType("org.junit.Test") + val test = im.getType("org.junit.jupiter.api.Test") val assertThat = im.getStatic("org.assertj.core.api.Assertions.assertThat") + val assertThrows = im.getStatic("org.junit.jupiter.api.Assertions.assertThrows") val naturalComparator = if (builderComparator || keyComparator) im.getStatic(s"io.vavr.collection.Comparators.naturalComparator") else null val map = im.getType(s"io.vavr.collection.$mapName") (1 to VARARGS).gen(arity => xs""" @@ -3491,7 +3498,8 @@ def generateTestClasses(): Unit = { genVavrFile("io.vavr", s"Tuple${i}Test", baseDir = TARGET_TEST)((im: ImportManager, packageName, className) => { - val test = im.getType("org.junit.Test") + val test = im.getType("org.junit.jupiter.api.Test") + val assertThrows = im.getStatic("org.junit.jupiter.api.Assertions.assertThrows") val seq = im.getType("io.vavr.collection.Seq") val list = im.getType("io.vavr.collection.List") val stream = if (i == 0) "" else im.getType("io.vavr.collection.Stream") diff --git a/vavr/pom.xml b/vavr/pom.xml index 68e7e4c899..b0fbd88d77 100644 --- a/vavr/pom.xml +++ b/vavr/pom.xml @@ -33,8 +33,8 @@ - junit - junit + org.junit.jupiter + junit-jupiter test diff --git a/vavr/src-gen/main/java/io/vavr/API.java b/vavr/src-gen/main/java/io/vavr/API.java index 4172dda3fa..346667aac3 100644 --- a/vavr/src-gen/main/java/io/vavr/API.java +++ b/vavr/src-gen/main/java/io/vavr/API.java @@ -5654,4 +5654,4 @@ public boolean isDefinedAt(T obj) { } } } -} +} \ No newline at end of file diff --git a/vavr/src-gen/test/java/io/vavr/APITest.java b/vavr/src-gen/test/java/io/vavr/APITest.java index de0599738d..fc1a50ff88 100644 --- a/vavr/src-gen/test/java/io/vavr/APITest.java +++ b/vavr/src-gen/test/java/io/vavr/APITest.java @@ -27,7 +27,8 @@ import static io.vavr.OutputTester.captureStdOut; import static io.vavr.Patterns.*; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.fail; import io.vavr.collection.List; import io.vavr.collection.Map; @@ -39,7 +40,7 @@ import java.util.Arrays; import java.util.Comparator; import java.util.concurrent.Executors; -import org.junit.Test; +import org.junit.jupiter.api.Test; @SuppressWarnings("deprecation") public class APITest { diff --git a/vavr/src-gen/test/java/io/vavr/CheckedFunction0Test.java b/vavr/src-gen/test/java/io/vavr/CheckedFunction0Test.java index 0096318b19..3a13040e6a 100644 --- a/vavr/src-gen/test/java/io/vavr/CheckedFunction0Test.java +++ b/vavr/src-gen/test/java/io/vavr/CheckedFunction0Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CheckedFunction0Test { @@ -151,11 +152,13 @@ public void shouldUncheckedWork() { assertThat(md5.getDigestLength()).isEqualTo(16); } - @Test(expected = NoSuchAlgorithmException.class) + @Test public void shouldThrowCheckedExceptionWhenUnchecked() { - CheckedFunction0 digest = () -> MessageDigest.getInstance("Unknown"); - Function0 unchecked = digest.unchecked(); - unchecked.apply(); // Look ma, we throw an undeclared checked exception! + assertThrows(NoSuchAlgorithmException.class, () -> { + CheckedFunction0 digest = () -> MessageDigest.getInstance("Unknown"); + Function0 unchecked = digest.unchecked(); + unchecked.apply(); // Look ma, we throw an undeclared checked exception! + }); } @Test diff --git a/vavr/src-gen/test/java/io/vavr/CheckedFunction1Test.java b/vavr/src-gen/test/java/io/vavr/CheckedFunction1Test.java index f0fb43e1f5..50844cf9b0 100644 --- a/vavr/src-gen/test/java/io/vavr/CheckedFunction1Test.java +++ b/vavr/src-gen/test/java/io/vavr/CheckedFunction1Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CheckedFunction1Test { @@ -161,10 +162,12 @@ public void shouldUncheckedWork() { assertThat(md5.getDigestLength()).isEqualTo(16); } - @Test(expected = NoSuchAlgorithmException.class) + @Test public void shouldUncheckedThrowIllegalState() { - final Function1 unchecked = digest.unchecked(); - unchecked.apply("Unknown"); // Look ma, we throw an undeclared checked exception! + assertThrows(NoSuchAlgorithmException.class, () -> { + final Function1 unchecked = digest.unchecked(); + unchecked.apply("Unknown"); // Look ma, we throw an undeclared checked exception! + }); } @Test diff --git a/vavr/src-gen/test/java/io/vavr/CheckedFunction2Test.java b/vavr/src-gen/test/java/io/vavr/CheckedFunction2Test.java index 42a5d0f5bf..914894201c 100644 --- a/vavr/src-gen/test/java/io/vavr/CheckedFunction2Test.java +++ b/vavr/src-gen/test/java/io/vavr/CheckedFunction2Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CheckedFunction2Test { @@ -160,10 +161,12 @@ public void shouldUncheckedWork() { assertThat(md5.getDigestLength()).isEqualTo(16); } - @Test(expected = NoSuchAlgorithmException.class) + @Test public void shouldUncheckedThrowIllegalState() { - final Function2 unchecked = digest.unchecked(); - unchecked.apply("U", "nknown"); // Look ma, we throw an undeclared checked exception! + assertThrows(NoSuchAlgorithmException.class, () -> { + final Function2 unchecked = digest.unchecked(); + unchecked.apply("U", "nknown"); // Look ma, we throw an undeclared checked exception! + }); } @Test diff --git a/vavr/src-gen/test/java/io/vavr/CheckedFunction3Test.java b/vavr/src-gen/test/java/io/vavr/CheckedFunction3Test.java index 1c664885aa..6304c551ba 100644 --- a/vavr/src-gen/test/java/io/vavr/CheckedFunction3Test.java +++ b/vavr/src-gen/test/java/io/vavr/CheckedFunction3Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CheckedFunction3Test { @@ -161,10 +162,12 @@ public void shouldUncheckedWork() { assertThat(md5.getDigestLength()).isEqualTo(16); } - @Test(expected = NoSuchAlgorithmException.class) + @Test public void shouldUncheckedThrowIllegalState() { - final Function3 unchecked = digest.unchecked(); - unchecked.apply("U", "n", "known"); // Look ma, we throw an undeclared checked exception! + assertThrows(NoSuchAlgorithmException.class, () -> { + final Function3 unchecked = digest.unchecked(); + unchecked.apply("U", "n", "known"); // Look ma, we throw an undeclared checked exception! + }); } @Test diff --git a/vavr/src-gen/test/java/io/vavr/CheckedFunction4Test.java b/vavr/src-gen/test/java/io/vavr/CheckedFunction4Test.java index 24a6d7120d..b050cc26e8 100644 --- a/vavr/src-gen/test/java/io/vavr/CheckedFunction4Test.java +++ b/vavr/src-gen/test/java/io/vavr/CheckedFunction4Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CheckedFunction4Test { @@ -162,10 +163,12 @@ public void shouldUncheckedWork() { assertThat(md5.getDigestLength()).isEqualTo(16); } - @Test(expected = NoSuchAlgorithmException.class) + @Test public void shouldUncheckedThrowIllegalState() { - final Function4 unchecked = digest.unchecked(); - unchecked.apply("U", "n", "k", "nown"); // Look ma, we throw an undeclared checked exception! + assertThrows(NoSuchAlgorithmException.class, () -> { + final Function4 unchecked = digest.unchecked(); + unchecked.apply("U", "n", "k", "nown"); // Look ma, we throw an undeclared checked exception! + }); } @Test diff --git a/vavr/src-gen/test/java/io/vavr/CheckedFunction5Test.java b/vavr/src-gen/test/java/io/vavr/CheckedFunction5Test.java index 43670b445a..b0308bf262 100644 --- a/vavr/src-gen/test/java/io/vavr/CheckedFunction5Test.java +++ b/vavr/src-gen/test/java/io/vavr/CheckedFunction5Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CheckedFunction5Test { @@ -163,10 +164,12 @@ public void shouldUncheckedWork() { assertThat(md5.getDigestLength()).isEqualTo(16); } - @Test(expected = NoSuchAlgorithmException.class) + @Test public void shouldUncheckedThrowIllegalState() { - final Function5 unchecked = digest.unchecked(); - unchecked.apply("U", "n", "k", "n", "own"); // Look ma, we throw an undeclared checked exception! + assertThrows(NoSuchAlgorithmException.class, () -> { + final Function5 unchecked = digest.unchecked(); + unchecked.apply("U", "n", "k", "n", "own"); // Look ma, we throw an undeclared checked exception! + }); } @Test diff --git a/vavr/src-gen/test/java/io/vavr/CheckedFunction6Test.java b/vavr/src-gen/test/java/io/vavr/CheckedFunction6Test.java index fcfa4fb648..3f1ccba9dd 100644 --- a/vavr/src-gen/test/java/io/vavr/CheckedFunction6Test.java +++ b/vavr/src-gen/test/java/io/vavr/CheckedFunction6Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CheckedFunction6Test { @@ -164,10 +165,12 @@ public void shouldUncheckedWork() { assertThat(md5.getDigestLength()).isEqualTo(16); } - @Test(expected = NoSuchAlgorithmException.class) + @Test public void shouldUncheckedThrowIllegalState() { - final Function6 unchecked = digest.unchecked(); - unchecked.apply("U", "n", "k", "n", "o", "wn"); // Look ma, we throw an undeclared checked exception! + assertThrows(NoSuchAlgorithmException.class, () -> { + final Function6 unchecked = digest.unchecked(); + unchecked.apply("U", "n", "k", "n", "o", "wn"); // Look ma, we throw an undeclared checked exception! + }); } @Test diff --git a/vavr/src-gen/test/java/io/vavr/CheckedFunction7Test.java b/vavr/src-gen/test/java/io/vavr/CheckedFunction7Test.java index 73632bcf17..07c20c56e2 100644 --- a/vavr/src-gen/test/java/io/vavr/CheckedFunction7Test.java +++ b/vavr/src-gen/test/java/io/vavr/CheckedFunction7Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CheckedFunction7Test { @@ -165,10 +166,12 @@ public void shouldUncheckedWork() { assertThat(md5.getDigestLength()).isEqualTo(16); } - @Test(expected = NoSuchAlgorithmException.class) + @Test public void shouldUncheckedThrowIllegalState() { - final Function7 unchecked = digest.unchecked(); - unchecked.apply("U", "n", "k", "n", "o", "w", "n"); // Look ma, we throw an undeclared checked exception! + assertThrows(NoSuchAlgorithmException.class, () -> { + final Function7 unchecked = digest.unchecked(); + unchecked.apply("U", "n", "k", "n", "o", "w", "n"); // Look ma, we throw an undeclared checked exception! + }); } @Test diff --git a/vavr/src-gen/test/java/io/vavr/CheckedFunction8Test.java b/vavr/src-gen/test/java/io/vavr/CheckedFunction8Test.java index ef2c073f6c..b90cead91e 100644 --- a/vavr/src-gen/test/java/io/vavr/CheckedFunction8Test.java +++ b/vavr/src-gen/test/java/io/vavr/CheckedFunction8Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CheckedFunction8Test { @@ -166,10 +167,12 @@ public void shouldUncheckedWork() { assertThat(md5.getDigestLength()).isEqualTo(16); } - @Test(expected = NoSuchAlgorithmException.class) + @Test public void shouldUncheckedThrowIllegalState() { - final Function8 unchecked = digest.unchecked(); - unchecked.apply("U", "n", "k", "n", "o", "w", "n", ""); // Look ma, we throw an undeclared checked exception! + assertThrows(NoSuchAlgorithmException.class, () -> { + final Function8 unchecked = digest.unchecked(); + unchecked.apply("U", "n", "k", "n", "o", "w", "n", ""); // Look ma, we throw an undeclared checked exception! + }); } @Test diff --git a/vavr/src-gen/test/java/io/vavr/Function0Test.java b/vavr/src-gen/test/java/io/vavr/Function0Test.java index 318bd3df04..fc6a504b10 100644 --- a/vavr/src-gen/test/java/io/vavr/Function0Test.java +++ b/vavr/src-gen/test/java/io/vavr/Function0Test.java @@ -24,11 +24,12 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Function0Test { diff --git a/vavr/src-gen/test/java/io/vavr/Function1Test.java b/vavr/src-gen/test/java/io/vavr/Function1Test.java index 22c3d1446a..3b4d004da5 100644 --- a/vavr/src-gen/test/java/io/vavr/Function1Test.java +++ b/vavr/src-gen/test/java/io/vavr/Function1Test.java @@ -25,11 +25,12 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Function1Test { diff --git a/vavr/src-gen/test/java/io/vavr/Function2Test.java b/vavr/src-gen/test/java/io/vavr/Function2Test.java index 6040e6d1db..ad804f8cef 100644 --- a/vavr/src-gen/test/java/io/vavr/Function2Test.java +++ b/vavr/src-gen/test/java/io/vavr/Function2Test.java @@ -24,11 +24,12 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Function2Test { diff --git a/vavr/src-gen/test/java/io/vavr/Function3Test.java b/vavr/src-gen/test/java/io/vavr/Function3Test.java index 1b9a352194..3a69d9fa39 100644 --- a/vavr/src-gen/test/java/io/vavr/Function3Test.java +++ b/vavr/src-gen/test/java/io/vavr/Function3Test.java @@ -24,11 +24,12 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Function3Test { diff --git a/vavr/src-gen/test/java/io/vavr/Function4Test.java b/vavr/src-gen/test/java/io/vavr/Function4Test.java index da5004eae7..c4fcfb1126 100644 --- a/vavr/src-gen/test/java/io/vavr/Function4Test.java +++ b/vavr/src-gen/test/java/io/vavr/Function4Test.java @@ -24,11 +24,12 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Function4Test { diff --git a/vavr/src-gen/test/java/io/vavr/Function5Test.java b/vavr/src-gen/test/java/io/vavr/Function5Test.java index ea6c4d78f0..a49c865c32 100644 --- a/vavr/src-gen/test/java/io/vavr/Function5Test.java +++ b/vavr/src-gen/test/java/io/vavr/Function5Test.java @@ -24,11 +24,12 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Function5Test { diff --git a/vavr/src-gen/test/java/io/vavr/Function6Test.java b/vavr/src-gen/test/java/io/vavr/Function6Test.java index c88b375365..ae8ba5ba6e 100644 --- a/vavr/src-gen/test/java/io/vavr/Function6Test.java +++ b/vavr/src-gen/test/java/io/vavr/Function6Test.java @@ -24,11 +24,12 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Function6Test { diff --git a/vavr/src-gen/test/java/io/vavr/Function7Test.java b/vavr/src-gen/test/java/io/vavr/Function7Test.java index e981925d40..b548efecf5 100644 --- a/vavr/src-gen/test/java/io/vavr/Function7Test.java +++ b/vavr/src-gen/test/java/io/vavr/Function7Test.java @@ -24,11 +24,12 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Function7Test { diff --git a/vavr/src-gen/test/java/io/vavr/Function8Test.java b/vavr/src-gen/test/java/io/vavr/Function8Test.java index 63c4a28d6e..955948f707 100644 --- a/vavr/src-gen/test/java/io/vavr/Function8Test.java +++ b/vavr/src-gen/test/java/io/vavr/Function8Test.java @@ -24,11 +24,12 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.control.Try; import java.lang.CharSequence; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Function8Test { diff --git a/vavr/src-gen/test/java/io/vavr/Tuple0Test.java b/vavr/src-gen/test/java/io/vavr/Tuple0Test.java index 1f8b88f026..fd0168fec6 100644 --- a/vavr/src-gen/test/java/io/vavr/Tuple0Test.java +++ b/vavr/src-gen/test/java/io/vavr/Tuple0Test.java @@ -24,12 +24,13 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.collection.List; import io.vavr.collection.Seq; import java.util.Comparator; import java.util.Objects; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Tuple0Test { diff --git a/vavr/src-gen/test/java/io/vavr/Tuple1Test.java b/vavr/src-gen/test/java/io/vavr/Tuple1Test.java index 44e392880e..bc9bde19f4 100644 --- a/vavr/src-gen/test/java/io/vavr/Tuple1Test.java +++ b/vavr/src-gen/test/java/io/vavr/Tuple1Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.collection.List; import io.vavr.collection.Seq; import io.vavr.collection.Stream; import java.util.Comparator; import java.util.Objects; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Tuple1Test { diff --git a/vavr/src-gen/test/java/io/vavr/Tuple2Test.java b/vavr/src-gen/test/java/io/vavr/Tuple2Test.java index af09ffea3a..8baef9208d 100644 --- a/vavr/src-gen/test/java/io/vavr/Tuple2Test.java +++ b/vavr/src-gen/test/java/io/vavr/Tuple2Test.java @@ -24,6 +24,7 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.collection.List; import io.vavr.collection.Seq; @@ -32,7 +33,7 @@ import java.util.Comparator; import java.util.Map; import java.util.Objects; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Tuple2Test { diff --git a/vavr/src-gen/test/java/io/vavr/Tuple3Test.java b/vavr/src-gen/test/java/io/vavr/Tuple3Test.java index 576d7cd2af..f9bedd34f1 100644 --- a/vavr/src-gen/test/java/io/vavr/Tuple3Test.java +++ b/vavr/src-gen/test/java/io/vavr/Tuple3Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.collection.List; import io.vavr.collection.Seq; import io.vavr.collection.Stream; import java.util.Comparator; import java.util.Objects; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Tuple3Test { diff --git a/vavr/src-gen/test/java/io/vavr/Tuple4Test.java b/vavr/src-gen/test/java/io/vavr/Tuple4Test.java index a5539dae2a..e30fdc9355 100644 --- a/vavr/src-gen/test/java/io/vavr/Tuple4Test.java +++ b/vavr/src-gen/test/java/io/vavr/Tuple4Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.collection.List; import io.vavr.collection.Seq; import io.vavr.collection.Stream; import java.util.Comparator; import java.util.Objects; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Tuple4Test { diff --git a/vavr/src-gen/test/java/io/vavr/Tuple5Test.java b/vavr/src-gen/test/java/io/vavr/Tuple5Test.java index 7201ab7a23..1f82c24755 100644 --- a/vavr/src-gen/test/java/io/vavr/Tuple5Test.java +++ b/vavr/src-gen/test/java/io/vavr/Tuple5Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.collection.List; import io.vavr.collection.Seq; import io.vavr.collection.Stream; import java.util.Comparator; import java.util.Objects; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Tuple5Test { diff --git a/vavr/src-gen/test/java/io/vavr/Tuple6Test.java b/vavr/src-gen/test/java/io/vavr/Tuple6Test.java index 8a92ac9a44..7de3c587b0 100644 --- a/vavr/src-gen/test/java/io/vavr/Tuple6Test.java +++ b/vavr/src-gen/test/java/io/vavr/Tuple6Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.collection.List; import io.vavr.collection.Seq; import io.vavr.collection.Stream; import java.util.Comparator; import java.util.Objects; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Tuple6Test { diff --git a/vavr/src-gen/test/java/io/vavr/Tuple7Test.java b/vavr/src-gen/test/java/io/vavr/Tuple7Test.java index 8c6f9b4140..6982af929f 100644 --- a/vavr/src-gen/test/java/io/vavr/Tuple7Test.java +++ b/vavr/src-gen/test/java/io/vavr/Tuple7Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.collection.List; import io.vavr.collection.Seq; import io.vavr.collection.Stream; import java.util.Comparator; import java.util.Objects; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Tuple7Test { diff --git a/vavr/src-gen/test/java/io/vavr/Tuple8Test.java b/vavr/src-gen/test/java/io/vavr/Tuple8Test.java index f34ef42353..4fa90fc14b 100644 --- a/vavr/src-gen/test/java/io/vavr/Tuple8Test.java +++ b/vavr/src-gen/test/java/io/vavr/Tuple8Test.java @@ -24,13 +24,14 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import io.vavr.collection.List; import io.vavr.collection.Seq; import io.vavr.collection.Stream; import java.util.Comparator; import java.util.Objects; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Tuple8Test { diff --git a/vavr/src-gen/test/java/io/vavr/collection/HashMapOfEntriesTest.java b/vavr/src-gen/test/java/io/vavr/collection/HashMapOfEntriesTest.java index 65d9c73a09..12e89142de 100644 --- a/vavr/src-gen/test/java/io/vavr/collection/HashMapOfEntriesTest.java +++ b/vavr/src-gen/test/java/io/vavr/collection/HashMapOfEntriesTest.java @@ -24,8 +24,9 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class HashMapOfEntriesTest { @Test diff --git a/vavr/src-gen/test/java/io/vavr/collection/HashMultimapOfEntriesTest.java b/vavr/src-gen/test/java/io/vavr/collection/HashMultimapOfEntriesTest.java index 447fc8c9c8..82c0cb9fcf 100644 --- a/vavr/src-gen/test/java/io/vavr/collection/HashMultimapOfEntriesTest.java +++ b/vavr/src-gen/test/java/io/vavr/collection/HashMultimapOfEntriesTest.java @@ -25,8 +25,9 @@ import static io.vavr.collection.Comparators.naturalComparator; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class HashMultimapOfEntriesTest { @Test diff --git a/vavr/src-gen/test/java/io/vavr/collection/LinkedHashMapOfEntriesTest.java b/vavr/src-gen/test/java/io/vavr/collection/LinkedHashMapOfEntriesTest.java index a57b8adccf..78e0accb01 100644 --- a/vavr/src-gen/test/java/io/vavr/collection/LinkedHashMapOfEntriesTest.java +++ b/vavr/src-gen/test/java/io/vavr/collection/LinkedHashMapOfEntriesTest.java @@ -24,8 +24,9 @@ \*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class LinkedHashMapOfEntriesTest { @Test diff --git a/vavr/src-gen/test/java/io/vavr/collection/LinkedHashMultimapOfEntriesTest.java b/vavr/src-gen/test/java/io/vavr/collection/LinkedHashMultimapOfEntriesTest.java index 6fb9520ea9..8aed98821b 100644 --- a/vavr/src-gen/test/java/io/vavr/collection/LinkedHashMultimapOfEntriesTest.java +++ b/vavr/src-gen/test/java/io/vavr/collection/LinkedHashMultimapOfEntriesTest.java @@ -25,8 +25,9 @@ import static io.vavr.collection.Comparators.naturalComparator; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class LinkedHashMultimapOfEntriesTest { @Test diff --git a/vavr/src-gen/test/java/io/vavr/collection/TreeMapOfEntriesTest.java b/vavr/src-gen/test/java/io/vavr/collection/TreeMapOfEntriesTest.java index 89c4d92591..da6dd56503 100644 --- a/vavr/src-gen/test/java/io/vavr/collection/TreeMapOfEntriesTest.java +++ b/vavr/src-gen/test/java/io/vavr/collection/TreeMapOfEntriesTest.java @@ -25,8 +25,9 @@ import static io.vavr.collection.Comparators.naturalComparator; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TreeMapOfEntriesTest { @Test diff --git a/vavr/src-gen/test/java/io/vavr/collection/TreeMultimapOfEntriesTest.java b/vavr/src-gen/test/java/io/vavr/collection/TreeMultimapOfEntriesTest.java index 0d37be53f2..79feec022c 100644 --- a/vavr/src-gen/test/java/io/vavr/collection/TreeMultimapOfEntriesTest.java +++ b/vavr/src-gen/test/java/io/vavr/collection/TreeMultimapOfEntriesTest.java @@ -25,8 +25,9 @@ import static io.vavr.collection.Comparators.naturalComparator; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class TreeMultimapOfEntriesTest { @Test diff --git a/vavr/src/test/java/io/vavr/AbstractValueTest.java b/vavr/src/test/java/io/vavr/AbstractValueTest.java index 663a282dbc..8495572fcc 100644 --- a/vavr/src/test/java/io/vavr/AbstractValueTest.java +++ b/vavr/src/test/java/io/vavr/AbstractValueTest.java @@ -29,7 +29,7 @@ import io.vavr.concurrent.Future; import io.vavr.control.Option; import org.assertj.core.api.*; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.Serializable; import java.util.*; @@ -105,6 +105,7 @@ protected StringAssert assertThat(String actual) { @Test(expected = NoSuchElementException.class) public void shouldGetEmpty() { + empty().get(); } diff --git a/vavr/src/test/java/io/vavr/CheckedConsumerTest.java b/vavr/src/test/java/io/vavr/CheckedConsumerTest.java index d432166386..f3da10b3fb 100644 --- a/vavr/src/test/java/io/vavr/CheckedConsumerTest.java +++ b/vavr/src/test/java/io/vavr/CheckedConsumerTest.java @@ -20,7 +20,7 @@ package io.vavr; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; diff --git a/vavr/src/test/java/io/vavr/CheckedPredicateTest.java b/vavr/src/test/java/io/vavr/CheckedPredicateTest.java index 3b8dfea6f4..ece6a452b1 100644 --- a/vavr/src/test/java/io/vavr/CheckedPredicateTest.java +++ b/vavr/src/test/java/io/vavr/CheckedPredicateTest.java @@ -20,7 +20,7 @@ package io.vavr; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.function.Predicate; diff --git a/vavr/src/test/java/io/vavr/CheckedRunnableTest.java b/vavr/src/test/java/io/vavr/CheckedRunnableTest.java index 1567ad2574..fa78883778 100644 --- a/vavr/src/test/java/io/vavr/CheckedRunnableTest.java +++ b/vavr/src/test/java/io/vavr/CheckedRunnableTest.java @@ -20,7 +20,7 @@ package io.vavr; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/IterableTest.java b/vavr/src/test/java/io/vavr/IterableTest.java index 9e991761ef..08a9453746 100644 --- a/vavr/src/test/java/io/vavr/IterableTest.java +++ b/vavr/src/test/java/io/vavr/IterableTest.java @@ -23,7 +23,7 @@ import io.vavr.collection.Stream; import io.vavr.collection.List; import io.vavr.control.Option; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.Collections; diff --git a/vavr/src/test/java/io/vavr/LazyTest.java b/vavr/src/test/java/io/vavr/LazyTest.java index f7b6c6378e..ac2e475515 100644 --- a/vavr/src/test/java/io/vavr/LazyTest.java +++ b/vavr/src/test/java/io/vavr/LazyTest.java @@ -25,7 +25,7 @@ import io.vavr.collection.List; import io.vavr.collection.Vector; import io.vavr.control.Option; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.Serializable; import java.util.NoSuchElementException; diff --git a/vavr/src/test/java/io/vavr/MatchErrorTest.java b/vavr/src/test/java/io/vavr/MatchErrorTest.java index 6292ae21bd..aa56936b9d 100644 --- a/vavr/src/test/java/io/vavr/MatchErrorTest.java +++ b/vavr/src/test/java/io/vavr/MatchErrorTest.java @@ -19,7 +19,7 @@ */ package io.vavr; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.API.$; import static io.vavr.API.*; diff --git a/vavr/src/test/java/io/vavr/MatchTest.java b/vavr/src/test/java/io/vavr/MatchTest.java index 13a1904d4c..81243335d5 100644 --- a/vavr/src/test/java/io/vavr/MatchTest.java +++ b/vavr/src/test/java/io/vavr/MatchTest.java @@ -27,7 +27,7 @@ import io.vavr.control.Validation; import io.vavr.match.annotation.Patterns; import io.vavr.match.annotation.Unapply; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.time.Year; diff --git a/vavr/src/test/java/io/vavr/OutputTester.java b/vavr/src/test/java/io/vavr/OutputTester.java index f4134c5b78..2862787fbb 100644 --- a/vavr/src/test/java/io/vavr/OutputTester.java +++ b/vavr/src/test/java/io/vavr/OutputTester.java @@ -19,7 +19,7 @@ */ package io.vavr; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.*; import java.nio.charset.Charset; diff --git a/vavr/src/test/java/io/vavr/PartialFunctionTest.java b/vavr/src/test/java/io/vavr/PartialFunctionTest.java index ead97da42e..ecfe25f957 100644 --- a/vavr/src/test/java/io/vavr/PartialFunctionTest.java +++ b/vavr/src/test/java/io/vavr/PartialFunctionTest.java @@ -23,7 +23,7 @@ import io.vavr.collection.List; import io.vavr.control.Either; import io.vavr.control.Option; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.function.Predicate; diff --git a/vavr/src/test/java/io/vavr/PredicatesTest.java b/vavr/src/test/java/io/vavr/PredicatesTest.java index 010bd5382f..1b4bcd6185 100644 --- a/vavr/src/test/java/io/vavr/PredicatesTest.java +++ b/vavr/src/test/java/io/vavr/PredicatesTest.java @@ -20,7 +20,7 @@ package io.vavr; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.function.Predicate; diff --git a/vavr/src/test/java/io/vavr/TupleTest.java b/vavr/src/test/java/io/vavr/TupleTest.java index 718d924e30..19e5ba71ca 100644 --- a/vavr/src/test/java/io/vavr/TupleTest.java +++ b/vavr/src/test/java/io/vavr/TupleTest.java @@ -21,7 +21,7 @@ import io.vavr.collection.List; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.AbstractMap; diff --git a/vavr/src/test/java/io/vavr/ValueTest.java b/vavr/src/test/java/io/vavr/ValueTest.java index 89c918b94e..c4f6e0dffd 100644 --- a/vavr/src/test/java/io/vavr/ValueTest.java +++ b/vavr/src/test/java/io/vavr/ValueTest.java @@ -21,7 +21,7 @@ import io.vavr.collection.List; import io.vavr.control.Option; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.stream.Collectors; diff --git a/vavr/src/test/java/io/vavr/collection/AbstractIndexedSeqTest.java b/vavr/src/test/java/io/vavr/collection/AbstractIndexedSeqTest.java index bc025db06b..bc6fc2b5e2 100644 --- a/vavr/src/test/java/io/vavr/collection/AbstractIndexedSeqTest.java +++ b/vavr/src/test/java/io/vavr/collection/AbstractIndexedSeqTest.java @@ -19,7 +19,7 @@ */ package io.vavr.collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.Spliterator; diff --git a/vavr/src/test/java/io/vavr/collection/AbstractLinearSeqTest.java b/vavr/src/test/java/io/vavr/collection/AbstractLinearSeqTest.java index 856b828065..30d36f4278 100644 --- a/vavr/src/test/java/io/vavr/collection/AbstractLinearSeqTest.java +++ b/vavr/src/test/java/io/vavr/collection/AbstractLinearSeqTest.java @@ -19,7 +19,7 @@ */ package io.vavr.collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; diff --git a/vavr/src/test/java/io/vavr/collection/AbstractMapTest.java b/vavr/src/test/java/io/vavr/collection/AbstractMapTest.java index 7fb81efd4b..5e5dea75c5 100644 --- a/vavr/src/test/java/io/vavr/collection/AbstractMapTest.java +++ b/vavr/src/test/java/io/vavr/collection/AbstractMapTest.java @@ -25,7 +25,7 @@ import io.vavr.Tuple2; import io.vavr.control.Option; import org.assertj.core.api.IterableAssert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; diff --git a/vavr/src/test/java/io/vavr/collection/AbstractMultimapTest.java b/vavr/src/test/java/io/vavr/collection/AbstractMultimapTest.java index b7943b9b65..730b2289e4 100644 --- a/vavr/src/test/java/io/vavr/collection/AbstractMultimapTest.java +++ b/vavr/src/test/java/io/vavr/collection/AbstractMultimapTest.java @@ -24,11 +24,16 @@ import io.vavr.Tuple2; import io.vavr.control.Option; import org.assertj.core.api.IterableAssert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.LinkedList; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Spliterator; +import org.junit.jupiter.api.TestTemplate; +import org.junit.jupiter.api.extension.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.BiConsumer; import java.util.function.BinaryOperator; @@ -39,28 +44,56 @@ import static java.util.Arrays.asList; -@RunWith(Parameterized.class) public abstract class AbstractMultimapTest extends AbstractTraversableTest { - @Parameterized.Parameters - public static Collection data() { - return asList(new Object[][] { - { Multimap.ContainerType.SEQ }, - { Multimap.ContainerType.SET }, - { Multimap.ContainerType.SORTED_SET } - }); + private static Collection types() { + return asList( + Multimap.ContainerType.SEQ, + Multimap.ContainerType.SET, + Multimap.ContainerType.SORTED_SET + ); } - @Parameterized.Parameter public Multimap.ContainerType containerType; + public static class TestTemplateProvider implements TestTemplateInvocationContextProvider { + + @Override + public boolean supportsTestTemplate(ExtensionContext context) { + return true; + } + + @Override + public java.util.stream.Stream provideTestTemplateInvocationContexts(ExtensionContext extensionContext) { + if(!extensionContext.getTestClass().map(AbstractMultimapTest.class::isAssignableFrom).orElse(false)) { + return java.util.stream.Stream.of(new DefaultTestTemplateInvocationContext()); + } + return types().stream().map(containerType -> new TestTemplateInvocationContext() { + @Override + public String getDisplayName(int invocationIndex) { + return "[" + containerType.toString() + "]"; + } + + @Override + public java.util.List getAdditionalExtensions() { + return java.util.Collections.singletonList((BeforeTestExecutionCallback) context -> { + AbstractMultimapTest instance = (AbstractMultimapTest) context.getRequiredTestInstance(); + instance.containerType = containerType; + }); + } + }); + } + } + + public static class DefaultTestTemplateInvocationContext implements TestTemplateInvocationContext { + } + @Override protected IterableAssert assertThat(Iterable actual) { return new IterableAssert(actual) { @Override public IterableAssert isEqualTo(Object obj) { - @SuppressWarnings("unchecked") - final Iterable expected = (Iterable) obj; + @SuppressWarnings("unchecked") final Iterable expected = (Iterable) obj; final java.util.Map actualMap = countMap(actual); final java.util.Map expectedMap = countMap(expected); assertThat(actualMap.size()).isEqualTo(expectedMap.size()); @@ -108,17 +141,17 @@ public java.util.Set characteristics() { private ArrayList> toTuples(java.util.List list) { final ArrayList> result = new ArrayList<>(); Stream.ofAll(list) - .zipWithIndex() - .map(tu -> Tuple.of(tu._2, tu._1)) - .forEach(result::add); + .zipWithIndex() + .map(tu -> Tuple.of(tu._2, tu._1)) + .forEach(result::add); return result; } private ArrayList fromTuples(java.util.List> list) { final ArrayList result = new ArrayList<>(); Stream.ofAll(list) - .map(tu -> tu._2) - .forEach(result::add); + .map(tu -> tu._2) + .forEach(result::add); return result; } }; @@ -294,7 +327,7 @@ protected IntMultimap fill(int n, Supplier s) { // -- construction - @Test + @TestTemplate public void shouldBeTheSame() { assertThat(mapOf(1, 2)).isEqualTo(emptyIntInt().put(1, 2)); } @@ -304,54 +337,54 @@ private static java.util.Map.Entry entry(String key, Integer va } @SuppressWarnings("unchecked") - @Test + @TestTemplate public void shouldConstructFromEntries() { final Multimap map = mapOfEntries(entry("1", 1), entry("2", 2), entry("3", 3)); - assertThat(map).isEqualTo(this. emptyMap().put("1", 1).put("2", 2).put("3", 3)); + assertThat(map).isEqualTo(this.emptyMap().put("1", 1).put("2", 2).put("3", 3)); } - @Test + @TestTemplate public void shouldConstructFromPairs() { final Multimap map = mapOfPairs("1", 1, "2", 2, "3", 3); - assertThat(map).isEqualTo(this. emptyMap().put("1", 1).put("2", 2).put("3", 3)); + assertThat(map).isEqualTo(this.emptyMap().put("1", 1).put("2", 2).put("3", 3)); } - @Test + @TestTemplate public void shouldConstructFromJavaStream() { final java.util.stream.Stream javaStream = java.util.stream.Stream.of(1, 2, 3); final Multimap map = mapOf(javaStream, String::valueOf, Function.identity()); - assertThat(map).isEqualTo(this. emptyMap().put("1", 1).put("2", 2).put("3", 3)); + assertThat(map).isEqualTo(this.emptyMap().put("1", 1).put("2", 2).put("3", 3)); } - @Test + @TestTemplate public void shouldConstructFromJavaStreamEntries() { final java.util.stream.Stream javaStream = java.util.stream.Stream.of(1, 2, 3); final Multimap map = mapOf(javaStream, i -> Tuple.of(String.valueOf(i), i)); - assertThat(map).isEqualTo(this. emptyMap().put("1", 1).put("2", 2).put("3", 3)); + assertThat(map).isEqualTo(this.emptyMap().put("1", 1).put("2", 2).put("3", 3)); } - @Test + @TestTemplate public void shouldConstructFromJavaMap() { final java.util.Map source = new java.util.HashMap<>(); source.put("1", 2); source.put("3", 4); final Multimap map = mapOf(source); - assertThat(map).isEqualTo(this. emptyMap().put("1", 2).put("3", 4)); + assertThat(map).isEqualTo(this.emptyMap().put("1", 2).put("3", 4)); } // -- asPartialFunction - @Test + @TestTemplate public void shouldApplyExistingKey() { assertThat(emptyIntInt().put(1, 2).asPartialFunction().apply(1)).isEqualTo(io.vavr.collection.HashSet.of(2)); } - @Test(expected = NoSuchElementException.class) + @TestTemplate(expected = NoSuchElementException.class) public void shouldApplyNonExistingKey() { emptyIntInt().put(1, 2).asPartialFunction().apply(3); } - @Test + @TestTemplate public void shouldImplementPartialFunction() { PartialFunction> f = mapOf(1, "1").asPartialFunction(); assertThat(f.isDefinedAt(1)).isTrue(); @@ -361,7 +394,7 @@ public void shouldImplementPartialFunction() { // -- asMap - @Test + @TestTemplate public void shouldConvertToMap() { Multimap mm = emptyIntInt().put(1, 2).put(1, 3); assertThat(mm.asMap().get(1).get()).isEqualTo(HashSet.of(2, 3)); @@ -369,39 +402,40 @@ public void shouldConvertToMap() { // -- biMap - @Test + @TestTemplate public void shouldBiMapEmpty() { assertThat(emptyInt().bimap(i -> i + 1, o -> o)).isEqualTo(io.vavr.collection.Vector.empty()); } - @Test + @TestTemplate public void shouldBiMapNonEmpty() { final Seq> expected = Stream.of(Tuple.of(2, "1!"), Tuple.of(3, "2!")); - final Seq> actual = emptyInt().put(1, "1").put(2, "2").bimap(i -> i + 1, s -> s + "!").toStream(); + final Seq> actual = emptyInt().put(1, "1").put(2, "2").bimap(i -> i + 1, s -> s + "!") + .toStream(); assertThat(actual).isEqualTo(expected); } // -- contains - @Test + @TestTemplate public void shouldFindKey() { assertThat(emptyIntInt().put(1, 2).containsKey(1)).isTrue(); assertThat(emptyIntInt().put(1, 2).containsKey(2)).isFalse(); } - @Test + @TestTemplate public void shouldFindValue() { assertThat(emptyIntInt().put(1, 2).containsValue(2)).isTrue(); assertThat(emptyIntInt().put(1, 2).containsValue(1)).isFalse(); } - @Test + @TestTemplate public void shouldRecognizeNotContainedKeyValuePair() { final Multimap testee = mapOf("one", 1); assertThat(testee.contains(Tuple.of("one", 0))).isFalse(); } - @Test + @TestTemplate public void shouldRecognizeContainedKeyValuePair() { final Multimap testee = mapOf("one", 1); assertThat(testee.contains(Tuple.of("one", 1))).isTrue(); @@ -411,20 +445,22 @@ public void shouldRecognizeContainedKeyValuePair() { @Override public void shouldComputeDistinctOfNonEmptyTraversable() { - final Multimap testee = this. emptyMap().put(1, 1).put(2, 2).put(3, 3); + final Multimap testee = this.emptyMap().put(1, 1).put(2, 2).put(3, 3); assertThat(testee.distinct()).isEqualTo(testee); } // -- equality - @Test + @TestTemplate public void shouldObeyEqualityConstraints() { // sequential collections assertThat(emptyMap().equals(HashMultimap.withSeq().empty())).isTrue(); assertThat(mapOf(1, "a").equals(HashMultimap.withSeq().of(1, "a"))).isTrue(); - assertThat(mapOfPairs(1, "a", 2, "b", 3, "c").equals(HashMultimap.withSeq().of(1, "a", 2, "b",3, "c"))).isTrue(); - assertThat(mapOfPairs(1, "a", 2, "b", 3, "c").equals(HashMultimap.withSeq().of(3, "c", 2, "b",1, "a"))).isTrue(); + assertThat(mapOfPairs(1, "a", 2, "b", 3, "c").equals(HashMultimap.withSeq() + .of(1, "a", 2, "b", 3, "c"))).isTrue(); + assertThat(mapOfPairs(1, "a", 2, "b", 3, "c").equals(HashMultimap.withSeq() + .of(3, "c", 2, "b", 1, "a"))).isTrue(); // other classes assertThat(empty().equals(io.vavr.collection.List.empty())).isFalse(); @@ -438,15 +474,14 @@ public void shouldObeyEqualityConstraints() { assertThat(empty().equals(TreeSet.empty())).isFalse(); } - - @Test + @TestTemplate public void shouldIgnoreOrderOfEntriesWhenComparingForEquality() { final Multimap map1 = emptyInt().put(1, 'a').put(2, 'b').put(3, 'c'); final Multimap map2 = emptyInt().put(3, 'c').put(2, 'b').put(1, 'a').remove(2).put(2, 'b'); assertThat(map1).isEqualTo(map2); } - @Test + @TestTemplate public void shouldHoldEqualsElements() { Multimap multimap = emptyMap(); multimap = multimap.put(1, "a").put(1, "b").put(1, "b"); @@ -459,68 +494,74 @@ public void shouldHoldEqualsElements() { // -- filter - @Test + @TestTemplate public void shouldBiFilterWork() throws Exception { final Multimap src = mapTabulate(20, n -> Tuple.of(n % 10, Integer.toHexString(n))); final Pattern isDigits = Pattern.compile("^\\d+$"); final Multimap dst = src.filter((k, v) -> k % 2 == 0 && isDigits.matcher(v).matches()); - assertThat(dst).isEqualTo(emptyIntString().put(0, "0").put(2, "2").put(4, "4").put(6, "6").put(6, "10").put(8, "8").put(8, "12")); + assertThat(dst).isEqualTo(emptyIntString().put(0, "0").put(2, "2").put(4, "4").put(6, "6").put(6, "10") + .put(8, "8").put(8, "12")); } - @Test + @TestTemplate public void shouldKeyFilterWork() throws Exception { final Multimap src = mapTabulate(20, n -> Tuple.of(n % 10, Integer.toHexString(n))); final Multimap dst = src.filterKeys(k -> k % 2 == 0); - assertThat(dst).isEqualTo(emptyIntString().put(0, "0").put(0, "a").put(2, "2").put(2, "c").put(4, "4").put(4, "e").put(6, "6").put(6, "10").put(8, "8").put(8, "12")); + assertThat(dst).isEqualTo(emptyIntString().put(0, "0").put(0, "a").put(2, "2").put(2, "c").put(4, "4") + .put(4, "e").put(6, "6").put(6, "10").put(8, "8").put(8, "12")); } - @Test + @TestTemplate public void shouldValueFilterWork() throws Exception { final Multimap src = mapTabulate(10, n -> Tuple.of(n % 5, Integer.toHexString(n))); final Pattern isDigits = Pattern.compile("^\\d+$"); final Multimap dst = src.filterValues(v -> isDigits.matcher(v).matches()); - assertThat(dst).isEqualTo(emptyIntString().put(0, "0").put(0, "5").put(1, "1").put(1, "6").put(2, "2").put(2, "7").put(3, "3").put(3, "8").put(4, "4").put(4, "9")); + assertThat(dst).isEqualTo(emptyIntString().put(0, "0").put(0, "5").put(1, "1").put(1, "6").put(2, "2") + .put(2, "7").put(3, "3").put(3, "8").put(4, "4").put(4, "9")); } // -- reject @SuppressWarnings("deprecation") - @Test + @TestTemplate public void shouldBiRejectWork() throws Exception { final Multimap src = mapTabulate(20, n -> Tuple.of(n % 10, Integer.toHexString(n))); final Pattern isDigits = Pattern.compile("^\\d+$"); final Multimap dst = src.reject((k, v) -> k % 2 == 0 && isDigits.matcher(v).matches()); - assertThat(dst).isEqualTo(emptyIntString().put(0, "a").put(1, "1").put(1, "b").put(2, "c").put(3, "3").put(3, "d").put(4, "e").put(5, "5").put(5, "f").put(7, "7").put(7, "11").put(9, "9").put(9, "13")); + assertThat(dst).isEqualTo(emptyIntString().put(0, "a").put(1, "1").put(1, "b").put(2, "c").put(3, "3") + .put(3, "d").put(4, "e").put(5, "5").put(5, "f").put(7, "7").put(7, "11").put(9, "9").put(9, "13")); } @SuppressWarnings("deprecation") - @Test + @TestTemplate public void shouldKeyRejectWork() throws Exception { final Multimap src = mapTabulate(20, n -> Tuple.of(n % 10, Integer.toHexString(n))); final Multimap dst = src.rejectKeys(k -> k % 2 == 0); - assertThat(dst).isEqualTo(emptyIntString().put(1, "1").put(1, "b").put(3, "3").put(3, "d").put(5, "5").put(5, "f").put(7, "7").put(7, "11").put(9, "9").put(9, "13")); + assertThat(dst).isEqualTo(emptyIntString().put(1, "1").put(1, "b").put(3, "3").put(3, "d").put(5, "5") + .put(5, "f").put(7, "7").put(7, "11").put(9, "9").put(9, "13")); } @SuppressWarnings("deprecation") - @Test + @TestTemplate public void shouldValueRejectWork() throws Exception { final Multimap src = mapTabulate(20, n -> Tuple.of(n % 10, Integer.toHexString(n))); final Pattern isDigits = Pattern.compile("^\\d+$"); final Multimap dst = src.rejectValues(v -> isDigits.matcher(v).matches()); - assertThat(dst).isEqualTo(emptyIntString().put(0, "a").put(1, "b").put(2, "c").put(3, "d").put(4, "e").put(5, "f")); + assertThat(dst).isEqualTo(emptyIntString().put(0, "a").put(1, "b").put(2, "c").put(3, "d").put(4, "e") + .put(5, "f")); } // -- flatMap @SuppressWarnings("unchecked") - @Test + @TestTemplate public void shouldFlatMapUsingBiFunction() { final Multimap testee = mapOfTuples(Tuple.of(1, 11), Tuple.of(2, 22), Tuple.of(3, 33)); final Multimap actual = testee - .flatMap((k, v) -> io.vavr.collection.List.of(Tuple.of(String.valueOf(k), String.valueOf(v)), - Tuple.of(String.valueOf(k * 10), String.valueOf(v * 10)))); + .flatMap((k, v) -> io.vavr.collection.List.of(Tuple.of(String.valueOf(k), String.valueOf(v)), + Tuple.of(String.valueOf(k * 10), String.valueOf(v * 10)))); final Multimap expected = mapOfTuples(Tuple.of("1", "11"), Tuple.of("10", "110"), Tuple.of("2", "22"), - Tuple.of("20", "220"), Tuple.of("3", "33"), Tuple.of("30", "330")); + Tuple.of("20", "220"), Tuple.of("3", "33"), Tuple.of("30", "330")); assertThat(actual).isEqualTo(expected); } @@ -529,31 +570,32 @@ public void shouldFlatMapUsingBiFunction() { @Override public void shouldFoldRightNonNil() { final String actual = of('a', 'b', 'c').foldRight("", (x, xs) -> x + xs); - final io.vavr.collection.List expected = io.vavr.collection.List.of('a', 'b', 'c').permutations().map(io.vavr.collection.List::mkString); + final io.vavr.collection.List expected = io.vavr.collection.List.of('a', 'b', 'c').permutations() + .map(io.vavr.collection.List::mkString); assertThat(actual).isIn(expected); } // -- forEach - @Test + @TestTemplate public void forEachByKeyValue() { final Multimap map = mapOf(1, 2).put(3, 4); - final int[] result = { 0 }; + final int[] result = {0}; map.forEach((k, v) -> result[0] += k + v); assertThat(result[0]).isEqualTo(10); } - @Test + @TestTemplate public void forEachByTuple() { final Multimap map = mapOf(1, 2).put(3, 4); - final int[] result = { 0 }; + final int[] result = {0}; map.forEach(t -> result[0] += t._1 + t._2); assertThat(result[0]).isEqualTo(10); } // -- getOrElse - @Test + @TestTemplate public void shouldReturnDefaultValue() { final Multimap map = mapOf("1", "a").put("2", "b"); assertThat(map.getOrElse("3", io.vavr.collection.List.of("3"))).isEqualTo(io.vavr.collection.List.of("3")); @@ -562,25 +604,26 @@ public void shouldReturnDefaultValue() { // -- groupBy @Override - @Test + @TestTemplate public void shouldNonNilGroupByIdentity() { final Map actual = of('a', 'b', 'c').groupBy(Function.identity()); - final Map expected = LinkedHashMap.empty().put('a', mapOf(0, 'a')).put('b', mapOf(1,'b')) - .put('c', mapOf(2,'c')); + final Map expected = LinkedHashMap.empty().put('a', mapOf(0, 'a')).put('b', mapOf(1, 'b')) + .put('c', mapOf(2, 'c')); assertThat(actual).isEqualTo(expected); } // -- iterator - @Test + @TestTemplate public void shouldReturnListWithMappedValues() { - assertThat(emptyIntInt().put(1, 1).put(2, 2).iterator((a, b) -> a + b)).isEqualTo(io.vavr.collection.List.of(2, 4)); + assertThat(emptyIntInt().put(1, 1).put(2, 2) + .iterator((a, b) -> a + b)).isEqualTo(io.vavr.collection.List.of(2, 4)); } // -- keySet @SuppressWarnings("unchecked") - @Test + @TestTemplate public void shouldReturnsKeySet() { final Set actual = mapOfTuples(Tuple.of(1, 11), Tuple.of(2, 22), Tuple.of(3, 33)).keySet(); assertThat(actual).isEqualTo(io.vavr.collection.HashSet.of(1, 2, 3)); @@ -588,40 +631,40 @@ public void shouldReturnsKeySet() { // -- map - @Test + @TestTemplate public void shouldMapEmpty() { assertThat(emptyInt().map(Tuple2::_1)).isEqualTo(io.vavr.collection.Vector.empty()); } - @Test + @TestTemplate public void shouldMapNonEmpty() { final Seq expected = io.vavr.collection.Vector.of(1, 2); final Seq actual = emptyInt().put(1, "1").put(2, "2").map(Tuple2::_1); assertThat(actual).isEqualTo(expected); } - @Test + @TestTemplate public void shouldMapComparableValues() { final Multimap map = this.emptyMap() - .put(1, "1") - .put(1, "2") - .put(2, "3"); + .put(1, "1") + .put(1, "2") + .put(2, "3"); assertThat(map.map(v -> v)).isEqualTo(io.vavr.collection.List.of( - Tuple.of(1, "1"), - Tuple.of(1, "2"), - Tuple.of(2, "3"))); + Tuple.of(1, "1"), + Tuple.of(1, "2"), + Tuple.of(2, "3"))); } - @Test + @TestTemplate public void shouldMapIncomparableValues() { final Multimap map = this.emptyMap(Comparator.comparing(Incomparable::getS)) - .put(1, new Incomparable("1")) - .put(1, new Incomparable("2")) - .put(2, new Incomparable("3")); + .put(1, new Incomparable("1")) + .put(1, new Incomparable("2")) + .put(2, new Incomparable("3")); assertThat(map.map(v -> v)).isEqualTo(io.vavr.collection.List.of( - Tuple.of(1, new Incomparable("1")), - Tuple.of(1, new Incomparable("2")), - Tuple.of(2, new Incomparable("3")))); + Tuple.of(1, new Incomparable("1")), + Tuple.of(1, new Incomparable("2")), + Tuple.of(2, new Incomparable("3")))); } private final static class Incomparable { @@ -649,55 +692,56 @@ public int hashCode() { // -- mapFill @SuppressWarnings("unchecked") - @Test + @TestTemplate public void shouldFillTheSeqCallingTheSupplierInTheRightOrder() { final LinkedList ints = new LinkedList<>(asList(0, 0, 1, 1, 2, 2)); - final Supplier> s = () -> new Tuple2<>(ints.remove().longValue(), ints.remove().floatValue()); + final Supplier> s = () -> new Tuple2<>(ints.remove().longValue(), ints.remove() + .floatValue()); final Multimap actual = mapFill(3, s); assertThat(actual).isEqualTo(mapOfTuples(new Tuple2<>(0L, 0f), new Tuple2<>(1L, 1f), new Tuple2<>(2L, 2f))); } - @Test + @TestTemplate public void shouldFillTheSeqWith0Elements() { assertThat(mapFill(0, () -> new Tuple2<>(1, 1))).isEqualTo(empty()); } - @Test + @TestTemplate public void shouldFillTheSeqWith0ElementsWhenNIsNegative() { assertThat(mapFill(-1, () -> new Tuple2<>(1, 1))).isEqualTo(empty()); } // -- fill(int, Supplier) - @Test + @TestTemplate public void shouldReturnManyMapAfterFillWithConstantSupplier() { AtomicInteger value = new AtomicInteger(83); assertThat(mapFill(17, () -> Tuple.of(7, value.getAndIncrement()))) - .hasSize(17); + .hasSize(17); } // -- fill(int, T) - @Test + @TestTemplate public void shouldReturnEmptyAfterFillWithZeroCount() { assertThat(mapFill(0, Tuple.of(7, 83))).isEqualTo(empty()); } - @Test + @TestTemplate public void shouldReturnEmptyAfterFillWithNegativeCount() { assertThat(mapFill(-1, Tuple.of(7, 83))).isEqualTo(empty()); } - @Test + @TestTemplate public void shouldReturnManyMapAfterFillWithConstant() { assertThat(mapFill(17, Tuple.of(7, 83))) - .hasSize(containerType == Multimap.ContainerType.SEQ ? 17 : 1); + .hasSize(containerType == Multimap.ContainerType.SEQ ? 17 : 1); } // -- mapTabulate @SuppressWarnings("unchecked") - @Test + @TestTemplate public void shouldTabulateTheSeq() { final Function> f = i -> new Tuple2<>(i.longValue(), i.floatValue()); final Multimap map = mapTabulate(3, f); @@ -705,34 +749,36 @@ public void shouldTabulateTheSeq() { } @SuppressWarnings("unchecked") - @Test + @TestTemplate public void shouldTabulateTheSeqCallingTheFunctionInTheRightOrder() { final LinkedList ints = new LinkedList<>(asList(0, 0, 1, 1, 2, 2)); - final Function> f = i -> new Tuple2<>(ints.remove().longValue(), ints.remove().floatValue()); + final Function> f = i -> new Tuple2<>(ints.remove().longValue(), ints.remove() + .floatValue()); final Multimap map = mapTabulate(3, f); assertThat(map).isEqualTo(mapOfTuples(new Tuple2<>(0L, 0f), new Tuple2<>(1L, 1f), new Tuple2<>(2L, 2f))); } - @Test + @TestTemplate public void shouldTabulateTheSeqWith0Elements() { assertThat(mapTabulate(0, i -> new Tuple2<>(i, i))).isEqualTo(empty()); } - @Test + @TestTemplate public void shouldTabulateTheSeqWith0ElementsWhenNIsNegative() { assertThat(mapTabulate(-1, i -> new Tuple2<>(i, i))).isEqualTo(empty()); } // -- mapValues - @Test + @TestTemplate public void shouldReturnModifiedValuesMap() { - assertThat(emptyIntString().put(1, "1").put(2, "2").mapValues(Integer::parseInt)).isEqualTo(emptyIntInt().put(1, 1).put(2, 2)); + assertThat(emptyIntString().put(1, "1").put(2, "2") + .mapValues(Integer::parseInt)).isEqualTo(emptyIntInt().put(1, 1).put(2, 2)); } // -- merge - @Test + @TestTemplate public void shouldMerge() { final Multimap m1 = emptyIntInt().put(1, 1).put(2, 2); final Multimap m2 = emptyIntInt().put(1, 1).put(4, 4); @@ -749,28 +795,30 @@ public void shouldMerge() { } @SuppressWarnings("unchecked") - @Test + @TestTemplate public void shouldMergeCollisions() { final Multimap m1 = emptyIntInt().put(1, 1).put(2, 2); final Multimap m2 = emptyIntInt().put(1, 2).put(4, 4); final Multimap m3 = emptyIntInt().put(3, 3).put(4, 4); assertThat(emptyIntInt().merge(m2, (s1, s2) -> io.vavr.collection.Iterator.concat(s1, s2))).isEqualTo(m2); assertThat(m2.merge(emptyIntInt(), (s1, s2) -> io.vavr.collection.Iterator.concat(s1, s2))).isEqualTo(m2); - assertThat(m1.merge(m2, (s1, s2) -> io.vavr.collection.Iterator.concat(s1, s2))).isEqualTo(emptyIntInt().put(1, 1).put(1, 2).put(2, 2).put(4, 4)); - assertThat(m1.merge(m3, (s1, s2) -> io.vavr.collection.Iterator.concat(s1, s2))).isEqualTo(emptyIntInt().put(1, 1).put(2, 2).put(3, 3).put(4, 4)); + assertThat(m1.merge(m2, (s1, s2) -> io.vavr.collection.Iterator.concat(s1, s2))).isEqualTo(emptyIntInt().put(1, 1) + .put(1, 2).put(2, 2).put(4, 4)); + assertThat(m1.merge(m3, (s1, s2) -> io.vavr.collection.Iterator.concat(s1, s2))).isEqualTo(emptyIntInt().put(1, 1) + .put(2, 2).put(3, 3).put(4, 4)); } // -- orElse // DEV-Note: IntMultimap converts `other` to multimap @Override - @Test + @TestTemplate public void shouldCaclEmptyOrElseSameOther() { Iterable other = of(42); assertThat(empty().orElse(other)).isEqualTo(other); } - @Test + @TestTemplate public void shouldCaclEmptyOrElseSameSupplier() { Iterable other = of(42); Supplier> supplier = () -> other; @@ -780,15 +828,15 @@ public void shouldCaclEmptyOrElseSameSupplier() { // -- partition @Override - @Test + @TestTemplate @SuppressWarnings("unchecked") public void shouldPartitionIntsInOddAndEvenHavingOddAndEvenNumbers() { assertThat(of(1, 2, 3, 4).partition(i -> i % 2 != 0)) - .isEqualTo(Tuple.of(mapOfTuples(Tuple.of(0, 1), Tuple.of(2, 3)), - mapOfTuples(Tuple.of(1, 2), Tuple.of(3, 4)))); + .isEqualTo(Tuple.of(mapOfTuples(Tuple.of(0, 1), Tuple.of(2, 3)), + mapOfTuples(Tuple.of(1, 2), Tuple.of(3, 4)))); } - @Test + @TestTemplate @SuppressWarnings("unchecked") public void shouldPartitionInOneIteration() { final AtomicInteger count = new AtomicInteger(0); @@ -804,14 +852,14 @@ public void shouldPartitionInOneIteration() { // -- put - @Test + @TestTemplate public void shouldPutTuple() { assertThat(emptyIntInt().put(Tuple.of(1, 2))).isEqualTo(emptyIntInt().put(1, 2)); } // -- remove - @Test + @TestTemplate public void shouldRemoveKey() { final Multimap src = emptyInt().put(1, 'a').put(2, 'b').put(3, 'c'); assertThat(src.remove(2)).isEqualTo(emptyInt().put(1, 'a').put(3, 'c')); @@ -820,16 +868,17 @@ public void shouldRemoveKey() { // -- replace - @Test + @TestTemplate public void shouldReplaceEntity() { - final Multimap actual = emptyInt().put(1, "a").put(1, "b").replace(Tuple.of(1, "a"), Tuple.of(1, "c")); + final Multimap actual = emptyInt().put(1, "a").put(1, "b") + .replace(Tuple.of(1, "a"), Tuple.of(1, "c")); final Multimap expected = emptyInt().put(1, "c").put(1, "b"); assertThat(actual).isEqualTo(expected); } // -- removeAll - @Test + @TestTemplate public void shouldRemoveAllKeys() { final Multimap src = emptyInt().put(1, 'a').put(2, 'b').put(3, 'c'); assertThat(src.removeAll(io.vavr.collection.List.of(1, 3))).isEqualTo(emptyInt().put(2, 'b')); @@ -840,41 +889,44 @@ public void shouldRemoveAllKeys() { // -- remove by filter @SuppressWarnings("deprecation") - @Test + @TestTemplate public void shouldBiRemoveWork() throws Exception { final Multimap src = mapTabulate(20, n -> Tuple.of(n % 10, Integer.toHexString(n))); final Pattern isDigits = Pattern.compile("^\\d+$"); final Multimap dst = src.removeAll((k, v) -> k % 2 == 0 && isDigits.matcher(v).matches()); - assertThat(dst).isEqualTo(emptyIntString().put(0, "a").put(1, "1").put(1, "b").put(2, "c").put(3, "3").put(3, "d").put(4, "e").put(5, "5").put(5, "f").put(7, "7").put(7, "11").put(9, "9").put(9, "13")); + assertThat(dst).isEqualTo(emptyIntString().put(0, "a").put(1, "1").put(1, "b").put(2, "c").put(3, "3") + .put(3, "d").put(4, "e").put(5, "5").put(5, "f").put(7, "7").put(7, "11").put(9, "9").put(9, "13")); } @SuppressWarnings("deprecation") - @Test + @TestTemplate public void shouldKeyRemoveWork() throws Exception { final Multimap src = mapTabulate(20, n -> Tuple.of(n % 10, Integer.toHexString(n))); final Multimap dst = src.removeKeys(k -> k % 2 == 0); - assertThat(dst).isEqualTo(emptyIntString().put(1, "1").put(1, "b").put(3, "3").put(3, "d").put(5, "5").put(5, "f").put(7, "7").put(7, "11").put(9, "9").put(9, "13")); + assertThat(dst).isEqualTo(emptyIntString().put(1, "1").put(1, "b").put(3, "3").put(3, "d").put(5, "5") + .put(5, "f").put(7, "7").put(7, "11").put(9, "9").put(9, "13")); } @SuppressWarnings("deprecation") - @Test + @TestTemplate public void shouldValueRemoveWork() throws Exception { final Multimap src = mapTabulate(20, n -> Tuple.of(n % 10, Integer.toHexString(n))); final Pattern isDigits = Pattern.compile("^\\d+$"); final Multimap dst = src.removeValues(v -> isDigits.matcher(v).matches()); - assertThat(dst).isEqualTo(emptyIntString().put(0, "a").put(1, "b").put(2, "c").put(3, "d").put(4, "e").put(5, "f")); + assertThat(dst).isEqualTo(emptyIntString().put(0, "a").put(1, "b").put(2, "c").put(3, "d").put(4, "e") + .put(5, "f")); } // -- replaceValue - @Test + @TestTemplate public void shouldReturnSameInstanceIfReplacingCurrentValueWithNonExistingKey() { final Multimap map = mapOf(1, "a").put(2, "b"); final Multimap actual = map.replaceValue(3, "?"); assertThat(actual).isSameAs(map); } - @Test + @TestTemplate public void shouldReplaceCurrentValueForExistingKey() { final Multimap map = mapOf(1, "a").put(2, "b"); final Multimap actual = map.replaceValue(2, "c"); @@ -882,7 +934,7 @@ public void shouldReplaceCurrentValueForExistingKey() { assertThat(actual).isEqualTo(expected); } - @Test + @TestTemplate public void shouldReplaceValuesWithNewValueForExistingKey() { final Multimap map = mapOf(1, "a").put(2, "b").put(2, "c"); final Multimap actual = map.replaceValue(2, "c"); @@ -892,7 +944,7 @@ public void shouldReplaceValuesWithNewValueForExistingKey() { // -- replace - @Test + @TestTemplate public void shouldReplaceCurrentValueForExistingKeyAndEqualOldValue() { final Multimap map = mapOf(1, "a").put(2, "b"); final Multimap actual = map.replace(2, "b", "c"); @@ -900,7 +952,7 @@ public void shouldReplaceCurrentValueForExistingKeyAndEqualOldValue() { assertThat(actual).isEqualTo(expected); } - @Test + @TestTemplate public void shouldReplaceCurrentValueForKeyWithMultipleValuesAndEqualOldValue() { final Multimap map = mapOf(1, "a").put(2, "b").put(2, "d"); final Multimap actual = map.replace(2, "b", "c"); @@ -908,14 +960,14 @@ public void shouldReplaceCurrentValueForKeyWithMultipleValuesAndEqualOldValue() assertThat(actual).isEqualTo(expected); } - @Test + @TestTemplate public void shouldReturnSameInstanceForExistingKeyAndNonEqualOldValue() { final Multimap map = mapOf(1, "a").put(2, "b"); final Multimap actual = map.replace(2, "d", "c"); assertThat(actual).isSameAs(map); } - @Test + @TestTemplate public void shouldReturnSameInstanceIfReplacingCurrentValueWithOldValueWithNonExistingKey() { final Multimap map = mapOf(1, "a").put(2, "b"); final Multimap actual = map.replace(3, "?", "!"); @@ -924,7 +976,7 @@ public void shouldReturnSameInstanceIfReplacingCurrentValueWithOldValueWithNonEx // - replaceAll - @Test + @TestTemplate public void shouldReplaceAllValuesWithFunctionResult() { final Multimap map = mapOf(1, "a").put(2, "b").put(2, "c"); final Multimap actual = map.replaceAll((integer, s) -> s + integer); @@ -935,41 +987,41 @@ public void shouldReplaceAllValuesWithFunctionResult() { // -- span @Override - @Test + @TestTemplate @SuppressWarnings("unchecked") public void shouldSpanNonNil() { assertThat(of(0, 1, 2, 3).span(i -> i < 2)) - .isEqualTo(Tuple.of(mapOfTuples(Tuple.of(0, 0), Tuple.of(1, 1)), - mapOfTuples(Tuple.of(2, 2), Tuple.of(3, 3)))); + .isEqualTo(Tuple.of(mapOfTuples(Tuple.of(0, 0), Tuple.of(1, 1)), + mapOfTuples(Tuple.of(2, 2), Tuple.of(3, 3)))); } @Override - @Test + @TestTemplate @SuppressWarnings("unchecked") public void shouldSpanAndNotTruncate() { assertThat(of(1, 1, 2, 2, 3, 3).span(x -> x % 2 == 1)) - .isEqualTo(Tuple.of(mapOfTuples(Tuple.of(0,1), Tuple.of(1, 1)), - mapOfTuples(Tuple.of(2, 2), Tuple.of(3, 2), - Tuple.of(4, 3), Tuple.of(5, 3)))); + .isEqualTo(Tuple.of(mapOfTuples(Tuple.of(0, 1), Tuple.of(1, 1)), + mapOfTuples(Tuple.of(2, 2), Tuple.of(3, 2), + Tuple.of(4, 3), Tuple.of(5, 3)))); assertThat(of(1, 1, 2, 2, 4, 4).span(x -> x == 1)) - .isEqualTo(Tuple.of(mapOfTuples(Tuple.of(0,1), Tuple.of(1, 1)), - mapOfTuples(Tuple.of(2, 2), Tuple.of(3, 2), - Tuple.of(4, 4), Tuple.of(5, 4)))); + .isEqualTo(Tuple.of(mapOfTuples(Tuple.of(0, 1), Tuple.of(1, 1)), + mapOfTuples(Tuple.of(2, 2), Tuple.of(3, 2), + Tuple.of(4, 4), Tuple.of(5, 4)))); } // -- spliterator - @Test + @TestTemplate public void shouldHaveSizedSpliterator() { assertThat(of(1, 2, 3).spliterator().hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED)).isTrue(); } - @Test + @TestTemplate public void shouldHaveDistinctSpliterator() { assertThat(of(1, 2, 3).spliterator().hasCharacteristics(Spliterator.DISTINCT)).isTrue(); } - @Test + @TestTemplate public void shouldReturnExactSizeIfKnownOfSpliterator() { assertThat(of(1, 2, 3).spliterator().getExactSizeIfKnown()).isEqualTo(3); } @@ -983,7 +1035,7 @@ public void shouldReturnSomeTailWhenCallingTailOptionOnNonNil() { // -- toJavaMap - @Test + @TestTemplate public void shouldConvertToJavaMap() { final Multimap vavr = mapOfPairs("1", 1, "2", 2, "3", 3); final java.util.Map> java = javaEmptyMap(); @@ -1014,19 +1066,20 @@ private java.util.Collection javaListOf(Integer i) { // -- toSet - @Test + @TestTemplate public void shouldReturnEmptySetWhenAskedForTuple2SetOfAnEmptyMap() { assertThat(emptyMap().toSet()).isEqualTo(io.vavr.collection.HashSet.empty()); } - @Test + @TestTemplate public void shouldReturnTuple2SetOfANonEmptyMap() { - assertThat(emptyInt().put(1, "1").put(2, "2").toSet()).isEqualTo(io.vavr.collection.HashSet.of(Tuple.of(1, "1"), Tuple.of(2, "2"))); + assertThat(emptyInt().put(1, "1").put(2, "2") + .toSet()).isEqualTo(io.vavr.collection.HashSet.of(Tuple.of(1, "1"), Tuple.of(2, "2"))); } // -- toString - @Test + @TestTemplate public void shouldMakeString() { assertThat(emptyMap().toString()).isEqualTo(className() + "()"); assertThat(emptyIntInt().put(1, 2).toString()).isEqualTo(className() + "(" + Tuple.of(1, 2) + ")"); @@ -1034,7 +1087,7 @@ public void shouldMakeString() { // -- transform - @Test + @TestTemplate public void shouldTransform() { final Multimap actual = emptyIntInt().put(1, 11).transform(map -> map.put(2, 22)); assertThat(actual).isEqualTo(emptyIntInt().put(1, 11).put(2, 22)); @@ -1042,14 +1095,14 @@ public void shouldTransform() { // -- unzip - @Test + @TestTemplate public void shouldUnzipNil() { assertThat(emptyMap().unzip(x -> Tuple.of(x, x))).isEqualTo(Tuple.of(Stream.empty(), Stream.empty())); assertThat(emptyMap().unzip((k, v) -> Tuple.of(Tuple.of(k, v), Tuple.of(k, v)))) - .isEqualTo(Tuple.of(Stream.empty(), Stream.empty())); + .isEqualTo(Tuple.of(Stream.empty(), Stream.empty())); } - @Test + @TestTemplate public void shouldUnzipNonNil() { final Multimap map = emptyIntInt().put(0, 0).put(1, 1); final Tuple actual = map.unzip(entry -> Tuple.of(entry._1, entry._2 + 1)); @@ -1057,14 +1110,14 @@ public void shouldUnzipNonNil() { assertThat(actual).isEqualTo(expected); } - @Test + @TestTemplate public void shouldUnzip3Nil() { assertThat(emptyMap().unzip3(x -> Tuple.of(x, x, x))).isEqualTo(Tuple.of(Stream.empty(), Stream.empty(), Stream.empty())); assertThat(emptyMap().unzip3((k, v) -> Tuple.of(Tuple.of(k, v), Tuple.of(k, v), Tuple.of(k, v)))) - .isEqualTo(Tuple.of(Stream.empty(), Stream.empty(), Stream.empty())); + .isEqualTo(Tuple.of(Stream.empty(), Stream.empty(), Stream.empty())); } - @Test + @TestTemplate public void shouldUnzip3NonNil() { final Multimap map = emptyIntInt().put(0, 0).put(1, 1); final Tuple actual = map.unzip3(entry -> Tuple.of(entry._1, entry._2 + 1, entry._2 + 5)); @@ -1074,157 +1127,159 @@ public void shouldUnzip3NonNil() { // -- zip - @Test + @TestTemplate public void shouldZipNils() { final Seq, Object>> actual = emptyIntInt().zip(io.vavr.collection.List.empty()); assertThat(actual).isEqualTo(Stream.empty()); } - @Test + @TestTemplate public void shouldZipEmptyAndNonNil() { final Seq, Integer>> actual = emptyIntInt().zip(io.vavr.collection.List.of(1)); assertThat(actual).isEqualTo(Stream.empty()); } - @Test + @TestTemplate public void shouldZipNonEmptyAndNil() { - final Seq, Object>> actual = emptyIntInt().put(0, 1).zip(io.vavr.collection.List.empty()); + final Seq, Object>> actual = emptyIntInt().put(0, 1) + .zip(io.vavr.collection.List.empty()); assertThat(actual).isEqualTo(Stream.empty()); } - @Test + @TestTemplate public void shouldZipNonNilsIfThisIsSmaller() { final Seq, Integer>> actual = emptyIntInt() - .put(0, 0) - .put(1, 1) - .zip(io.vavr.collection.List.of(5, 6, 7)); + .put(0, 0) + .put(1, 1) + .zip(io.vavr.collection.List.of(5, 6, 7)); assertThat(actual).isEqualTo(Stream.of(Tuple.of(Tuple.of(0, 0), 5), Tuple.of(Tuple.of(1, 1), 6))); } - @Test + @TestTemplate public void shouldZipNonNilsIfThatIsSmaller() { final Seq, Integer>> actual = emptyIntInt() - .put(0, 0) - .put(1, 1) - .put(2, 2) - .zip(io.vavr.collection.List.of(5, 6)); + .put(0, 0) + .put(1, 1) + .put(2, 2) + .zip(io.vavr.collection.List.of(5, 6)); assertThat(actual).isEqualTo(Stream.of(Tuple.of(Tuple.of(0, 0), 5), Tuple.of(Tuple.of(1, 1), 6))); } - @Test + @TestTemplate public void shouldZipNonNilsOfSameSize() { final Seq, Integer>> actual = emptyIntInt() - .put(0, 0) - .put(1, 1) - .put(2, 2) - .zip(io.vavr.collection.List.of(5, 6, 7)); + .put(0, 0) + .put(1, 1) + .put(2, 2) + .zip(io.vavr.collection.List.of(5, 6, 7)); assertThat(actual).isEqualTo( - Stream.of(Tuple.of(Tuple.of(0, 0), 5), Tuple.of(Tuple.of(1, 1), 6), Tuple.of(Tuple.of(2, 2), 7))); + Stream.of(Tuple.of(Tuple.of(0, 0), 5), Tuple.of(Tuple.of(1, 1), 6), Tuple.of(Tuple.of(2, 2), 7))); } - @Test(expected = NullPointerException.class) + @TestTemplate(expected = NullPointerException.class) public void shouldThrowIfZipWithThatIsNull() { emptyMap().zip(null); } // -- zipWithIndex - @Test + @TestTemplate public void shouldZipNilWithIndex() { assertThat(emptyMap().zipWithIndex()).isEqualTo(Stream.empty()); } - @Test + @TestTemplate public void shouldZipNonNilWithIndex() { final Seq, Integer>> actual = emptyIntInt() - .put(0, 0) - .put(1, 1) - .put(2, 2) - .zipWithIndex(); + .put(0, 0) + .put(1, 1) + .put(2, 2) + .zipWithIndex(); assertThat(actual).isEqualTo( - Stream.of(Tuple.of(Tuple.of(0, 0), 0), Tuple.of(Tuple.of(1, 1), 1), Tuple.of(Tuple.of(2, 2), 2))); + Stream.of(Tuple.of(Tuple.of(0, 0), 0), Tuple.of(Tuple.of(1, 1), 1), Tuple.of(Tuple.of(2, 2), 2))); } // -- zipAll - @Test + @TestTemplate public void shouldZipAllNils() { final Seq, Object>> actual = emptyIntInt().zipAll(empty(), null, null); assertThat(actual).isEqualTo(Stream.empty()); } - @Test + @TestTemplate public void shouldZipAllEmptyAndNonNil() { final Seq, Object>> actual = emptyIntInt().zipAll(io.vavr.collection.List.of(1), null, null); assertThat(actual).isEqualTo(Stream.of(Tuple.of(null, 1))); } - @Test + @TestTemplate public void shouldZipAllNonEmptyAndNil() { - final Seq, Object>> actual = emptyIntInt().put(0, 1).zipAll(empty(), null, null); + final Seq, Object>> actual = emptyIntInt().put(0, 1) + .zipAll(empty(), null, null); assertThat(actual).isEqualTo(Stream.of(Tuple.of(Tuple.of(0, 1), null))); } - @Test + @TestTemplate public void shouldZipAllNonNilsIfThisIsSmaller() { - final Seq, String>> actual = this. emptyMap() - .put(1, 1) - .put(2, 2) - .zipAll(of("a", "b", "c"), Tuple.of(9, 10), "z"); + final Seq, String>> actual = this.emptyMap() + .put(1, 1) + .put(2, 2) + .zipAll(of("a", "b", "c"), Tuple.of(9, 10), "z"); final Seq, String>> expected = Stream.of(Tuple.of(Tuple.of(1, 1), "a"), - Tuple.of(Tuple.of(2, 2), "b"), Tuple.of(Tuple.of(9, 10), "c")); + Tuple.of(Tuple.of(2, 2), "b"), Tuple.of(Tuple.of(9, 10), "c")); assertThat(actual).isEqualTo(expected); } - @Test + @TestTemplate public void shouldZipAllNonNilsIfThisIsMoreSmaller() { - final Seq, String>> actual = this. emptyMap() - .put(1, 1) - .put(2, 2) - .zipAll(of("a", "b", "c", "d"), Tuple.of(9, 10), "z"); + final Seq, String>> actual = this.emptyMap() + .put(1, 1) + .put(2, 2) + .zipAll(of("a", "b", "c", "d"), Tuple.of(9, 10), "z"); final Seq, String>> expected = Stream.of(Tuple.of(Tuple.of(1, 1), "a"), - Tuple.of(Tuple.of(2, 2), "b"), Tuple.of(Tuple.of(9, 10), "c"), Tuple.of(Tuple.of(9, 10), "d")); + Tuple.of(Tuple.of(2, 2), "b"), Tuple.of(Tuple.of(9, 10), "c"), Tuple.of(Tuple.of(9, 10), "d")); assertThat(actual).isEqualTo(expected); } - @Test + @TestTemplate public void shouldZipAllNonNilsIfThatIsSmaller() { - final Seq, String>> actual = this. emptyMap() - .put(1, 1) - .put(2, 2) - .put(3, 3) - .zipAll(this.of("a", "b"), Tuple.of(9, 10), "z"); + final Seq, String>> actual = this.emptyMap() + .put(1, 1) + .put(2, 2) + .put(3, 3) + .zipAll(this.of("a", "b"), Tuple.of(9, 10), "z"); final Seq, String>> expected = Stream.of(Tuple.of(Tuple.of(1, 1), "a"), - Tuple.of(Tuple.of(2, 2), "b"), Tuple.of(Tuple.of(3, 3), "z")); + Tuple.of(Tuple.of(2, 2), "b"), Tuple.of(Tuple.of(3, 3), "z")); assertThat(actual).isEqualTo(expected); } - @Test + @TestTemplate public void shouldZipAllNonNilsIfThatIsMoreSmaller() { - final Seq, String>> actual = this. emptyMap() - .put(1, 1) - .put(2, 2) - .put(3, 3) - .put(4, 4) - .zipAll(of("a", "b"), Tuple.of(9, 10), "z"); + final Seq, String>> actual = this.emptyMap() + .put(1, 1) + .put(2, 2) + .put(3, 3) + .put(4, 4) + .zipAll(of("a", "b"), Tuple.of(9, 10), "z"); final Seq, String>> expected = Stream.of(Tuple.of(Tuple.of(1, 1), "a"), - Tuple.of(Tuple.of(2, 2), "b"), Tuple.of(Tuple.of(3, 3), "z"), Tuple.of(Tuple.of(4, 4), "z")); + Tuple.of(Tuple.of(2, 2), "b"), Tuple.of(Tuple.of(3, 3), "z"), Tuple.of(Tuple.of(4, 4), "z")); assertThat(actual).isEqualTo(expected); } - @Test + @TestTemplate public void shouldZipAllNonNilsOfSameSize() { - final Seq, String>> actual = this. emptyMap() - .put(1, 1) - .put(2, 2) - .put(3, 3) - .zipAll(of("a", "b", "c"), Tuple.of(9, 10), "z"); + final Seq, String>> actual = this.emptyMap() + .put(1, 1) + .put(2, 2) + .put(3, 3) + .zipAll(of("a", "b", "c"), Tuple.of(9, 10), "z"); final Seq, String>> expected = Stream.of(Tuple.of(Tuple.of(1, 1), "a"), - Tuple.of(Tuple.of(2, 2), "b"), Tuple.of(Tuple.of(3, 3), "c")); + Tuple.of(Tuple.of(2, 2), "b"), Tuple.of(Tuple.of(3, 3), "c")); assertThat(actual).isEqualTo(expected); } - @Test(expected = NullPointerException.class) + @TestTemplate(expected = NullPointerException.class) public void shouldThrowIfZipAllWithThatIsNull() { emptyMap().zipAll(null, null, null); } @@ -1237,24 +1292,23 @@ public void shouldPreserveSingletonInstanceOnDeserialization() { } @Override - @Test + @TestTemplate public void shouldCreateSeqOfSeqUsingCons() { // this Traversable test is not suited for Multimaps: // io.vavr.collection.List$Nil cannot be cast to java.lang.Comparable } @Override - @Test + @TestTemplate public void shouldConvertToJavaArrayWithTypeHintPrimitiveVoid() { // this Value test is not suited for Multimaps: // java.lang.NullPointerException at io.vavr.collection.Comparators.lambda$naturalComparator } @Override - @Test + @TestTemplate public void shouldCollectUsingMultimap() { // this Traversable test is not suited for Multimaps: // java.lang.ClassCastException: io.vavr.collection.List$Cons cannot be cast to java.lang.Comparable } - } diff --git a/vavr/src/test/java/io/vavr/collection/AbstractSeqTest.java b/vavr/src/test/java/io/vavr/collection/AbstractSeqTest.java index b672af31c7..d79f949b3b 100644 --- a/vavr/src/test/java/io/vavr/collection/AbstractSeqTest.java +++ b/vavr/src/test/java/io/vavr/collection/AbstractSeqTest.java @@ -22,7 +22,7 @@ import io.vavr.Tuple; import io.vavr.control.Option; import io.vavr.Tuple2; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.ArrayList; diff --git a/vavr/src/test/java/io/vavr/collection/AbstractSetTest.java b/vavr/src/test/java/io/vavr/collection/AbstractSetTest.java index 3cb0ba137f..cfc188d14e 100644 --- a/vavr/src/test/java/io/vavr/collection/AbstractSetTest.java +++ b/vavr/src/test/java/io/vavr/collection/AbstractSetTest.java @@ -20,7 +20,7 @@ package io.vavr.collection; import io.vavr.Tuple2; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.Spliterator; diff --git a/vavr/src/test/java/io/vavr/collection/AbstractSortedMapTest.java b/vavr/src/test/java/io/vavr/collection/AbstractSortedMapTest.java index 8caf0fb7ed..bbbfb3de11 100644 --- a/vavr/src/test/java/io/vavr/collection/AbstractSortedMapTest.java +++ b/vavr/src/test/java/io/vavr/collection/AbstractSortedMapTest.java @@ -19,7 +19,7 @@ */ package io.vavr.collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.Spliterator; diff --git a/vavr/src/test/java/io/vavr/collection/AbstractSortedSetTest.java b/vavr/src/test/java/io/vavr/collection/AbstractSortedSetTest.java index 28526e0d90..e50da6d1e1 100644 --- a/vavr/src/test/java/io/vavr/collection/AbstractSortedSetTest.java +++ b/vavr/src/test/java/io/vavr/collection/AbstractSortedSetTest.java @@ -21,7 +21,7 @@ import org.assertj.core.api.Assertions; import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.Comparator; diff --git a/vavr/src/test/java/io/vavr/collection/AbstractTraversableRangeTest.java b/vavr/src/test/java/io/vavr/collection/AbstractTraversableRangeTest.java index 408b388a79..13140f9d1e 100644 --- a/vavr/src/test/java/io/vavr/collection/AbstractTraversableRangeTest.java +++ b/vavr/src/test/java/io/vavr/collection/AbstractTraversableRangeTest.java @@ -19,7 +19,7 @@ */ package io.vavr.collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; public abstract class AbstractTraversableRangeTest extends AbstractTraversableTest { diff --git a/vavr/src/test/java/io/vavr/collection/AbstractTraversableTest.java b/vavr/src/test/java/io/vavr/collection/AbstractTraversableTest.java index 0b75349d2e..1cc1749648 100644 --- a/vavr/src/test/java/io/vavr/collection/AbstractTraversableTest.java +++ b/vavr/src/test/java/io/vavr/collection/AbstractTraversableTest.java @@ -19,27 +19,49 @@ */ package io.vavr.collection; -import io.vavr.*; +import io.vavr.AbstractValueTest; +import io.vavr.PartialFunction; +import io.vavr.Tuple; +import io.vavr.Tuple2; import io.vavr.control.Option; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import java.io.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; import java.math.BigDecimal; import java.math.BigInteger; -import java.util.*; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Spliterator; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collector; -import static io.vavr.API.*; -import static io.vavr.OutputTester.*; +import static io.vavr.API.$; +import static io.vavr.API.Case; +import static io.vavr.API.List; +import static io.vavr.API.Map; +import static io.vavr.OutputTester.captureErrOut; +import static io.vavr.OutputTester.captureStdOut; +import static io.vavr.OutputTester.failingPrintStream; +import static io.vavr.OutputTester.failingPrintWriter; +import static io.vavr.OutputTester.withFailingErrOut; +import static io.vavr.OutputTester.withFailingStdOut; import static java.lang.System.lineSeparator; import static java.util.Arrays.asList; import static java.util.Comparator.comparingInt; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.fail; import static org.assertj.core.api.Assertions.within; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTimeout; public abstract class AbstractTraversableTest extends AbstractValueTest { @@ -213,9 +235,9 @@ public void shouldReturnNoneWhenComputingAverageOfNil() { assertThat(empty().average()).isEqualTo(Option.none()); } - @Test(expected = UnsupportedOperationException.class) + @Test public void shouldThrowWhenComputingAverageOfStrings() { - of("1", "2", "3").average(); + assertThrows(UnsupportedOperationException.class, () -> of("1", "2", "3").average()); } @Test @@ -277,7 +299,7 @@ public void shouldCalculateAverageOfFloatsContainingNaN() { @Test public void shouldCalculateAverageOfDoubleAndFloat() { - assertThat(this. of(1.0, 1.0f).average().get()).isEqualTo(1.0); + assertThat(this.of(1.0, 1.0f).average().get()).isEqualTo(1.0); } @Test @@ -295,18 +317,20 @@ public void shouldCalculateAverageOfFloatPositiveAndNegativeInfinity() { @Test public void shouldThrowOnCollectWhenPartialFunctionIsNull() { assertThatThrownBy(() -> empty().collect((PartialFunction) null)) - .isExactlyInstanceOf(NullPointerException.class) - .hasMessage("partialFunction is null"); + .isExactlyInstanceOf(NullPointerException.class) + .hasMessage("partialFunction is null"); } @Test public void shouldCollectUsingPartialFunction() { final PartialFunction pf = new PartialFunction() { private static final long serialVersionUID = 1L; + @Override public String apply(Integer i) { return String.valueOf(i); } + @Override public boolean isDefinedAt(Integer i) { return i % 2 == 1; @@ -319,7 +343,7 @@ public boolean isDefinedAt(Integer i) { @Test public void shouldCollectUsingCase() { final Traversable actual = of(1, 2, 3).collect( - Case($(i -> i % 2 == 1), String::valueOf) + Case($(i -> i % 2 == 1), String::valueOf) ); assertThat(actual).isEqualTo(of("1", "3")); } @@ -444,20 +468,20 @@ public void shouldComputeDistinctOfNonEmptyTraversable() { public void shouldComputeDistinctByOfEmptyTraversableUsingComparator() { final Comparator comparator = comparingInt(i -> i); if (useIsEqualToInsteadOfIsSameAs()) { - assertThat(this. empty().distinctBy(comparator)).isEqualTo(empty()); + assertThat(this.empty().distinctBy(comparator)).isEqualTo(empty()); } else { - assertThat(this. empty().distinctBy(comparator)).isSameAs(empty()); + assertThat(this.empty().distinctBy(comparator)).isSameAs(empty()); } } @Test public void shouldComputeDistinctByOfNonEmptyTraversableUsingComparator() { final Comparator comparator = comparingInt(s -> (s.charAt(1))); - final Traversable distinct = of("1a", "2a", "3a", "3b", "4b", "5c").distinctBy(comparator).map(s -> s.substring(1)); + final Traversable distinct = of("1a", "2a", "3a", "3b", "4b", "5c").distinctBy(comparator) + .map(s -> s.substring(1)); assertThat(distinct).isEqualTo(of("a", "b", "c")); } - @Test public void shouldReturnSameInstanceWhenDistinctByComparatorEmptyTraversable() { final Traversable empty = empty(); @@ -478,7 +502,8 @@ public void shouldComputeDistinctByOfEmptyTraversableUsingKeyExtractor() { @Test public void shouldComputeDistinctByOfNonEmptyTraversableUsingKeyExtractor() { final Function function = c -> c.charAt(1); - final Traversable distinct = of("1a", "2a", "3a", "3b", "4b", "5c").distinctBy(function).map(s -> s.substring(1)); + final Traversable distinct = of("1a", "2a", "3a", "3b", "4b", "5c").distinctBy(function) + .map(s -> s.substring(1)); assertThat(distinct).isEqualTo(of("a", "b", "c")); } @@ -683,7 +708,7 @@ public void shouldBeAwareOfExistingUniqueElement() { @Test public void shouldBeAwareOfNonExistingUniqueElement() { - assertThat(this. empty().existsUnique(i -> i == 1)).isFalse(); + assertThat(this.empty().existsUnique(i -> i == 1)).isFalse(); } @Test @@ -709,10 +734,10 @@ public void shouldFilterExistingElements() { @Test public void shouldFilterNonExistingElements() { if (useIsEqualToInsteadOfIsSameAs()) { - assertThat(this. empty().filter(i -> i == 0)).isEqualTo(empty()); + assertThat(this.empty().filter(i -> i == 0)).isEqualTo(empty()); assertThat(of(1, 2, 3).filter(i -> i == 0)).isEqualTo(empty()); } else { - assertThat(this. empty().filter(i -> i == 0)).isSameAs(empty()); + assertThat(this.empty().filter(i -> i == 0)).isSameAs(empty()); assertThat(of(1, 2, 3).filter(i -> i == 0)).isSameAs(empty()); } } @@ -741,10 +766,10 @@ public void shouldRejectExistingElements() { @Test public void shouldRejectNonExistingElements() { if (useIsEqualToInsteadOfIsSameAs()) { - assertThat(this. empty().reject(i -> i == 0)).isEqualTo(empty()); + assertThat(this.empty().reject(i -> i == 0)).isEqualTo(empty()); assertThat(of(1, 2, 3).reject(i -> i > 0)).isEqualTo(empty()); } else { - assertThat(this. empty().reject(i -> i == 0)).isSameAs(empty()); + assertThat(this.empty().reject(i -> i == 0)).isSameAs(empty()); assertThat(of(1, 2, 3).reject(i -> i > 0)).isSameAs(empty()); } } @@ -799,12 +824,12 @@ public void shouldFlatMapNonEmpty() { @Test public void shouldFoldNil() { - assertThat(this. empty().fold("", (a, b) -> a + b)).isEqualTo(""); + assertThat(this.empty().fold("", (a, b) -> a + b)).isEqualTo(""); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenFoldNullOperator() { - this. empty().fold(null, null); + assertThrows(NullPointerException.class, () -> this.empty().fold(null, null)); } @Test @@ -821,12 +846,12 @@ public void shouldFoldMultipleElements() { @Test public void shouldFoldLeftNil() { - assertThat(this. empty().foldLeft("", (xs, x) -> xs + x)).isEqualTo(""); + assertThat(this.empty().foldLeft("", (xs, x) -> xs + x)).isEqualTo(""); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenFoldLeftNullOperator() { - this. empty().foldLeft(null, null); + assertThrows(NullPointerException.class, () -> this.empty().foldLeft(null, null)); } @Test @@ -838,12 +863,12 @@ public void shouldFoldLeftNonNil() { @Test public void shouldFoldRightNil() { - assertThat(this. empty().foldRight("", (x, xs) -> x + xs)).isEqualTo(""); + assertThat(this.empty().foldRight("", (x, xs) -> x + xs)).isEqualTo(""); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenFoldRightNullOperator() { - this. empty().foldRight(null, null); + assertThrows(NullPointerException.class, () -> this.empty().foldRight(null, null)); } @Test @@ -855,8 +880,8 @@ public void shouldFoldRightNonNil() { @Test public void shouldConsumeNoElementWithIndexWhenEmpty() { - final boolean[] actual = { false }; - final boolean[] expected = { false }; + final boolean[] actual = {false}; + final boolean[] expected = {false}; empty().forEachWithIndex((chr, index) -> actual[0] = true); assertThat(actual).isEqualTo(expected); } @@ -899,7 +924,7 @@ public void shouldNilArrangeBy() { @Test public void shouldNonNilArrangeByIdentity() { - final Option> actual = of('a', 'b', 'c').arrangeBy(Function.identity()); + final Option> actual = of('a', 'b', 'c').arrangeBy(Function.identity()); final Option> expected = Option.of(LinkedHashMap.empty().put('a', 'a').put('b', 'b').put('c', 'c')); assertThat(actual).isEqualTo(expected); } @@ -918,33 +943,36 @@ public void shouldGroupedNil() { assertThat(empty().grouped(1).isEmpty()).isTrue(); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowWhenGroupedWithSizeZero() { - empty().grouped(0); + assertThrows(IllegalArgumentException.class, () -> empty().grouped(0)); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowWhenGroupedWithNegativeSize() { - empty().grouped(-1); + assertThrows(IllegalArgumentException.class, () -> empty().grouped(-1)); } @Test public void shouldGroupedTraversableWithEqualSizedBlocks() { - final List> actual = of(1, 2, 3, 4).grouped(2).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1, 2, 3, 4).grouped(2).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1, 2), io.vavr.collection.Vector.of(3, 4)); assertThat(actual).isEqualTo(expected); } @Test public void shouldGroupedTraversableWithRemainder() { - final List> actual = of(1, 2, 3, 4, 5).grouped(2).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1, 2, 3, 4, 5).grouped(2).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1, 2), io.vavr.collection.Vector.of(3, 4), io.vavr.collection.Vector.of(5)); assertThat(actual).isEqualTo(expected); } @Test public void shouldGroupedWhenTraversableLengthIsSmallerThanBlockSize() { - final List> actual = of(1, 2, 3, 4).grouped(5).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1, 2, 3, 4).grouped(5).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1, 2, 3, 4)); assertThat(actual).isEqualTo(expected); } @@ -958,9 +986,9 @@ public void shouldReturnSomethingOnHasDefiniteSize() { // -- head - @Test(expected = NoSuchElementException.class) + @Test public void shouldThrowWhenHeadOnNil() { - empty().head(); + assertThrows(NoSuchElementException.class, () -> empty().head()); } @Test @@ -982,9 +1010,9 @@ public void shouldReturnSomeHeadWhenCallingHeadOptionOnNonNil() { // -- init - @Test(expected = UnsupportedOperationException.class) + @Test public void shouldThrowWhenInitOfNil() { - empty().init().get(); + assertThrows(UnsupportedOperationException.class, () -> empty().init()); } @Test @@ -1023,9 +1051,9 @@ public void shouldNotHasNextWhenNilIterator() { assertThat(empty().iterator().hasNext()).isFalse(); } - @Test(expected = NoSuchElementException.class) + @Test public void shouldThrowOnNextWhenNilIterator() { - empty().iterator().next(); + assertThrows(NoSuchElementException.class, () -> empty().iterator().next()); } @Test @@ -1132,9 +1160,9 @@ public void shouldMkCharSeqWithDelimiterAndPrefixAndSuffixNonNil() { // -- last - @Test(expected = NoSuchElementException.class) + @Test public void shouldThrowWhenLastOnNil() { - empty().last(); + assertThrows(NoSuchElementException.class, () -> empty().last()); } @Test @@ -1174,7 +1202,9 @@ public void shouldReturnNoneWhenComputingMaxOfNil() { } @Test - public void shouldComputeMaxOfOneValue() { assertThat(of(5).max()).isEqualTo(Option.some(5)); } + public void shouldComputeMaxOfOneValue() { + assertThat(of(5).max()).isEqualTo(Option.some(5)); + } @Test public void shouldComputeMaxOfStrings() { @@ -1231,14 +1261,14 @@ public void shouldComputeMaxOfBigDecimal() { assertThat(of(BigDecimal.ZERO, BigDecimal.ONE).max()).isEqualTo(Option.some(BigDecimal.ONE)); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowNPEWhenMaxOfNullAndInt() { - of(null, 1).max(); + assertThrows(NullPointerException.class, () -> of(null, 1).max()); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowNPEWhenMaxOfIntAndNull() { - of(1, null).max(); + assertThrows(NullPointerException.class, () -> of(1, null).max()); } @Test @@ -1253,12 +1283,13 @@ public void shouldCalculateMaxOfFloatsContainingNaN() { @Test public void shouldThrowClassCastExceptionWhenTryingToCalculateMaxOfDoubleAndFloat() { - assertThatThrownBy(() -> this. of(1.0, 1.0f).max()).isInstanceOf(ClassCastException.class); + assertThatThrownBy(() -> this.of(1.0, 1.0f).max()).isInstanceOf(ClassCastException.class); } @Test public void shouldCalculateMaxOfDoublePositiveAndNegativeInfinity() { - assertThat(of(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY).max().get()).isEqualTo(Double.POSITIVE_INFINITY); + assertThat(of(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY).max() + .get()).isEqualTo(Double.POSITIVE_INFINITY); } @Test @@ -1268,9 +1299,9 @@ public void shouldCalculateMaxOfFloatPositiveAndNegativeInfinity() { // -- maxBy(Comparator) - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenMaxByWithNullComparator() { - of(1).maxBy((Comparator) null); + assertThrows(NullPointerException.class, () -> of(1).maxBy((Comparator) null)); } @Test @@ -1290,14 +1321,14 @@ public void shouldCalculateInverseMaxByOfInts() { // -- maxBy(Function) - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenMaxByWithNullFunction() { - of(1).maxBy((Function) null); + assertThrows(NullPointerException.class, () -> of(1).maxBy((Function) null)); } @Test public void shouldThrowWhenMaxByFunctionOfNil() { - assertThat(this. empty().maxBy(i -> i)).isEqualTo(Option.none()); + assertThat(this.empty().maxBy(i -> i)).isEqualTo(Option.none()); } @Test @@ -1312,7 +1343,7 @@ public void shouldCalculateInverseMaxByFunctionOfInts() { @Test public void shouldCallMaxFunctionOncePerElement() { - final int[] cnt = { 0 }; + final int[] cnt = {0}; assertThat(of(1, 2, 3).maxBy(i -> { cnt[0]++; return i; @@ -1328,7 +1359,9 @@ public void shouldReturnNoneWhenComputingMinOfNil() { } @Test - public void shouldComputeMinOfOneValue() { assertThat(of(5).min()).isEqualTo(Option.some(5)); } + public void shouldComputeMinOfOneValue() { + assertThat(of(5).min()).isEqualTo(Option.some(5)); + } @Test public void shouldComputeMinOfStrings() { @@ -1385,14 +1418,14 @@ public void shouldComputeMinOfBigDecimal() { assertThat(of(BigDecimal.ZERO, BigDecimal.ONE).min()).isEqualTo(Option.some(BigDecimal.ZERO)); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowNPEWhenMinOfNullAndInt() { - of(null, 1).min(); + assertThrows(NullPointerException.class, () -> of(null, 1).min()); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowNPEWhenMinOfIntAndNull() { - of(1, null).min(); + assertThrows(NullPointerException.class, () -> of(1, null).min()); } @Test @@ -1407,24 +1440,26 @@ public void shouldCalculateMinOfFloatsContainingNaN() { @Test public void shouldThrowClassCastExceptionWhenTryingToCalculateMinOfDoubleAndFloat() { - assertThatThrownBy(() -> this. of(1.0, 1.0f).min()).isInstanceOf(ClassCastException.class); + assertThatThrownBy(() -> this.of(1.0, 1.0f).min()).isInstanceOf(ClassCastException.class); } @Test public void shouldCalculateMinOfDoublePositiveAndNegativeInfinity() { - assertThat(of(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY).min().get()).isEqualTo(Double.NEGATIVE_INFINITY); + assertThat(of(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY).min() + .get()).isEqualTo(Double.NEGATIVE_INFINITY); } @Test public void shouldCalculateMinOfFloatPositiveAndNegativeInfinity() { - assertThat(of(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY).min().get()).isEqualTo(Double.NEGATIVE_INFINITY); + assertThat(of(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY).min() + .get()).isEqualTo(Double.NEGATIVE_INFINITY); } // -- minBy(Comparator) - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenMinByWithNullComparator() { - of(1).minBy((Comparator) null); + assertThrows(NullPointerException.class, () -> of(1).minBy((Comparator) null)); } @Test @@ -1444,14 +1479,14 @@ public void shouldCalculateInverseMinByOfInts() { // -- minBy(Function) - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenMinByWithNullFunction() { - of(1).minBy((Function) null); + assertThrows(NullPointerException.class, () -> of(1).minBy((Function) null)); } @Test public void shouldThrowWhenMinByFunctionOfNil() { - assertThat(this. empty().minBy(i -> i)).isEqualTo(Option.none()); + assertThat(this.empty().minBy(i -> i)).isEqualTo(Option.none()); } @Test @@ -1466,7 +1501,7 @@ public void shouldCalculateInverseMinByFunctionOfInts() { @Test public void shouldCallMinFunctionOncePerElement() { - final int[] cnt = { 0 }; + final int[] cnt = {0}; assertThat(of(1, 2, 3).minBy(i -> { cnt[0]++; return i; @@ -1521,9 +1556,9 @@ public void shouldCaclNonemptyOrElseSupplier() { // -- partition - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenPartitionNilAndPredicateIsNull() { - empty().partition(null); + assertThrows(NullPointerException.class, () -> empty().partition(null)); } @Test @@ -1553,9 +1588,9 @@ public void shouldComputeProductOfNil() { assertThat(empty().product()).isEqualTo(1); } - @Test(expected = UnsupportedOperationException.class) + @Test public void shouldThrowWhenComputingProductOfStrings() { - of("1", "2", "3").product(); + assertThrows(UnsupportedOperationException.class, () -> of("1", "2", "3").product()); } @Test @@ -1602,12 +1637,12 @@ public void shouldComputeProductOfBigDecimal() { @Test public void shouldThrowWhenReduceOptionNil() { - assertThat(this. empty().reduceOption((a, b) -> a + b)).isSameAs(Option.none()); + assertThat(this.empty().reduceOption((a, b) -> a + b)).isSameAs(Option.none()); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenReduceOptionNullOperator() { - this. empty().reduceOption(null); + assertThrows(NullPointerException.class, () -> this.empty().reduceOption(null)); } @Test @@ -1617,14 +1652,14 @@ public void shouldReduceOptionNonNil() { // -- reduce - @Test(expected = NoSuchElementException.class) + @Test public void shouldThrowWhenReduceNil() { - this. empty().reduce((a, b) -> a + b); + assertThrows(NoSuchElementException.class, () -> this.empty().reduce((a, b) -> a + b)); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenReduceNullOperator() { - this. empty().reduce(null); + assertThrows(NullPointerException.class, () -> this.empty().reduce(null)); } @Test @@ -1636,12 +1671,12 @@ public void shouldReduceNonNil() { @Test public void shouldThrowWhenReduceLeftOptionNil() { - assertThat(this. empty().reduceLeftOption((a, b) -> a + b)).isSameAs(Option.none()); + assertThat(this.empty().reduceLeftOption((a, b) -> a + b)).isSameAs(Option.none()); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenReduceLeftOptionNullOperator() { - this. empty().reduceLeftOption(null); + assertThrows(NullPointerException.class, () -> this.empty().reduceLeftOption(null)); } @Test @@ -1651,14 +1686,14 @@ public void shouldReduceLeftOptionNonNil() { // -- reduceLeft - @Test(expected = NoSuchElementException.class) + @Test public void shouldThrowWhenReduceLeftNil() { - this. empty().reduceLeft((a, b) -> a + b); + assertThrows(NoSuchElementException.class, () -> this.empty().reduceLeft((a, b) -> a + b)); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenReduceLeftNullOperator() { - this. empty().reduceLeft(null); + assertThrows(NullPointerException.class, () -> this.empty().reduceLeft(null)); } @Test @@ -1670,12 +1705,12 @@ public void shouldReduceLeftNonNil() { @Test public void shouldThrowWhenReduceRightOptionNil() { - assertThat(this. empty().reduceRightOption((a, b) -> a + b)).isSameAs(Option.none()); + assertThat(this.empty().reduceRightOption((a, b) -> a + b)).isSameAs(Option.none()); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenReduceRightOptionNullOperator() { - this. empty().reduceRightOption(null); + assertThrows(NullPointerException.class, () -> this.empty().reduceRightOption(null)); } @Test @@ -1685,14 +1720,14 @@ public void shouldReduceRightOptionNonNil() { // -- reduceRight - @Test(expected = NoSuchElementException.class) + @Test public void shouldThrowWhenReduceRightNil() { - this. empty().reduceRight((a, b) -> a + b); + assertThrows(NoSuchElementException.class, () -> this.empty().reduceRight((a, b) -> a + b)); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowWhenReduceRightNullOperator() { - this. empty().reduceRight(null); + assertThrows(NullPointerException.class, () -> this.empty().reduceRight(null)); } @Test @@ -1705,9 +1740,9 @@ public void shouldReduceRightNonNil() { @Test public void shouldReplaceElementOfNilUsingCurrNew() { if (useIsEqualToInsteadOfIsSameAs()) { - assertThat(this. empty().replace(1, 2)).isEqualTo(empty()); + assertThat(this.empty().replace(1, 2)).isEqualTo(empty()); } else { - assertThat(this. empty().replace(1, 2)).isSameAs(empty()); + assertThat(this.empty().replace(1, 2)).isSameAs(empty()); } } @@ -1739,9 +1774,9 @@ public void shouldReplaceElementOfNonNilUsingCurrNewWhenNoOccurrenceExists() { @Test public void shouldReplaceAllElementsOfNilUsingCurrNew() { if (useIsEqualToInsteadOfIsSameAs()) { - assertThat(this. empty().replaceAll(1, 2)).isEqualTo(empty()); + assertThat(this.empty().replaceAll(1, 2)).isEqualTo(empty()); } else { - assertThat(this. empty().replaceAll(1, 2)).isSameAs(empty()); + assertThat(this.empty().replaceAll(1, 2)).isSameAs(empty()); } } @@ -1886,65 +1921,71 @@ public void shouldSlideNilByClassifier() { assertThat(empty().slideBy(Function.identity())).isEmpty(); } - @Test(timeout=1000) + @Test public void shouldTerminateSlideByClassifier() { - AtomicInteger ai = new AtomicInteger(0); - List> expected = List.of(List.of("a", "-"), List.of( "-"), List.of("d") ); - List> actual = List.of("a", "-", "-", "d") - .slideBy(x -> x.equals("-") ? ai.getAndIncrement() : ai.get()) - .toList(); - assertThat(actual).containsAll(expected); - assertThat(expected).containsAll(actual); + assertTimeout(Duration.ofSeconds(1),() -> { + AtomicInteger ai = new AtomicInteger(0); + List> expected = List.of(List.of("a", "-"), List.of("-"), List.of("d")); + List> actual = List.of("a", "-", "-", "d") + .slideBy(x -> x.equals("-") ? ai.getAndIncrement() : ai.get()) + .toList(); + assertThat(actual).containsAll(expected); + assertThat(expected).containsAll(actual); + }); } @Test public void shouldSlideSingularByClassifier() { - final List> actual = of(1).slideBy(Function.identity()).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1).slideBy(Function.identity()).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1)); assertThat(actual).isEqualTo(expected); } @Test public void shouldSlideNonNilByIdentityClassifier() { - final List> actual = of(1, 2, 3).slideBy(Function.identity()).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1, 2, 3).slideBy(Function.identity()).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1), io.vavr.collection.Vector.of(2), io.vavr.collection.Vector.of(3)); assertThat(actual).isEqualTo(expected); } @Test public void shouldSlideNonNilByConstantClassifier() { - final List> actual = of(1, 2, 3).slideBy(e -> "same").toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1, 2, 3).slideBy(e -> "same").toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1, 2, 3)); assertThat(actual).isEqualTo(expected); } @Test public void shouldSlideNonNilBySomeClassifier() { - final List> actual = of(10, 20, 30, 42, 52, 60, 72).slideBy(e -> e % 10).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(10, 20, 30, 42, 52, 60, 72).slideBy(e -> e % 10).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(10, 20, 30), io.vavr.collection.Vector.of(42, 52), io.vavr.collection.Vector.of(60), io.vavr.collection.Vector.of(72)); assertThat(actual).isEqualTo(expected); } // -- sliding(size) - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowWhenSlidingNilByZeroSize() { - empty().sliding(0); + assertThrows(IllegalArgumentException.class, () -> empty().sliding(0)); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowWhenSlidingNilByNegativeSize() { - empty().sliding(-1); + assertThrows(IllegalArgumentException.class, () -> empty().sliding(-1)); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowWhenSlidingNonNilByZeroSize() { - of(1).sliding(0); + assertThrows(IllegalArgumentException.class, () -> of(1).sliding(0)); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowWhenSlidingNonNilByNegativeSize() { - of(1).sliding(-1); + assertThrows(IllegalArgumentException.class, () -> of(1).sliding(-1)); } @Test @@ -1961,26 +2002,27 @@ public void shouldSlideNonNilBySize1() { @Test public void shouldSlideNonNilBySize2() { - final List> actual = of(1, 2, 3, 4, 5).sliding(2).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1, 2, 3, 4, 5).sliding(2).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1, 2), io.vavr.collection.Vector.of(2, 3), io.vavr.collection.Vector.of(3, 4), io.vavr.collection.Vector.of(4, 5)); assertThat(actual).isEqualTo(expected); } // -- sliding(size, step) - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowWhenSlidingNilByPositiveStepAndNegativeSize() { - empty().sliding(-1, 1); + assertThrows(IllegalArgumentException.class, () -> empty().sliding(-1, 1)); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowWhenSlidingNilByNegativeStepAndNegativeSize() { - empty().sliding(-1, -1); + assertThrows(IllegalArgumentException.class, () -> empty().sliding(-1, -1)); } - @Test(expected = IllegalArgumentException.class) + @Test public void shouldThrowWhenSlidingNilByNegativeStepAndPositiveSize() { - empty().sliding(1, -1); + assertThrows(IllegalArgumentException.class, () -> empty().sliding(1, -1)); } @Test @@ -1990,42 +2032,48 @@ public void shouldSlideNilBySizeAndStep() { @Test public void shouldSlide5ElementsBySize2AndStep3() { - final List> actual = of(1, 2, 3, 4, 5).sliding(2, 3).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1, 2, 3, 4, 5).sliding(2, 3).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1, 2), io.vavr.collection.Vector.of(4, 5)); assertThat(actual).isEqualTo(expected); } @Test public void shouldSlide5ElementsBySize2AndStep4() { - final List> actual = of(1, 2, 3, 4, 5).sliding(2, 4).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1, 2, 3, 4, 5).sliding(2, 4).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1, 2), io.vavr.collection.Vector.of(5)); assertThat(actual).isEqualTo(expected); } @Test public void shouldSlide5ElementsBySize2AndStep5() { - final List> actual = of(1, 2, 3, 4, 5).sliding(2, 5).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1, 2, 3, 4, 5).sliding(2, 5).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1, 2)); assertThat(actual).isEqualTo(expected); } @Test public void shouldSlide4ElementsBySize5AndStep3() { - final List> actual = of(1, 2, 3, 4).sliding(5, 3).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1, 2, 3, 4).sliding(5, 3).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1, 2, 3, 4)); assertThat(actual).isEqualTo(expected); } @Test public void shouldSlide7ElementsBySize1AndStep3() { - final List> actual = of(1, 2, 3, 4, 5, 6 ,7).sliding(1, 3).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1, 2, 3, 4, 5, 6, 7).sliding(1, 3).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1), io.vavr.collection.Vector.of(4), io.vavr.collection.Vector.of(7)); assertThat(actual).isEqualTo(expected); } @Test public void shouldSlide7ElementsBySize2AndStep3() { - final List> actual = of(1, 2, 3, 4, 5, 6 ,7).sliding(2, 3).toList().map(io.vavr.collection.Vector::ofAll); + final List> actual = of(1, 2, 3, 4, 5, 6, 7).sliding(2, 3).toList() + .map(io.vavr.collection.Vector::ofAll); final List> expected = List.of(io.vavr.collection.Vector.of(1, 2), io.vavr.collection.Vector.of(4, 5), io.vavr.collection.Vector.of(7)); assertThat(actual).isEqualTo(expected); } @@ -2034,7 +2082,7 @@ public void shouldSlide7ElementsBySize2AndStep3() { @Test public void shouldSpanNil() { - assertThat(this. empty().span(i -> i < 2)).isEqualTo(Tuple.of(empty(), empty())); + assertThat(this.empty().span(i -> i < 2)).isEqualTo(Tuple.of(empty(), empty())); } @Test @@ -2073,28 +2121,28 @@ public void shouldHaveImmutableSpliterator() { @Test public void shouldWriteToStderr() { - assertThat(captureErrOut(()->of(1, 2, 3).stderr())).isEqualTo("1\n" + - "2\n" + - "3\n"); + assertThat(captureErrOut(() -> of(1, 2, 3).stderr())).isEqualTo("1\n" + + "2\n" + + "3\n"); } - @Test(expected = IllegalStateException.class) + @Test public void shouldHandleStderrIOException() { - withFailingErrOut(()->of(0).stderr()); + assertThrows(IllegalStateException.class, () -> withFailingErrOut(() -> of(0).stderr())); } // -- stdout @Test public void shouldWriteToStdout() { - assertThat(captureStdOut(()->of(1, 2, 3).stdout())).isEqualTo("1\n" + - "2\n" + - "3\n"); + assertThat(captureStdOut(() -> of(1, 2, 3).stdout())).isEqualTo("1\n" + + "2\n" + + "3\n"); } - @Test(expected = IllegalStateException.class) + @Test public void shouldHandleStdoutIOException() { - withFailingStdOut(()->of(0).stdout()); + assertThrows(IllegalStateException.class, () -> withFailingStdOut(() -> of(0).stdout())); } // -- PrintStream @@ -2107,11 +2155,13 @@ public void shouldWriteToPrintStream() { assertThat(baos.toString()).isEqualTo(of(1, 2, 3).mkString("", lineSeparator(), lineSeparator())); } - @Test(expected = IllegalStateException.class) + @Test public void shouldHandlePrintStreamIOException() { - try (PrintStream failingPrintStream = failingPrintStream()) { - of(0).out(failingPrintStream); - } + assertThrows(IllegalStateException.class, () -> { + try (PrintStream failingPrintStream = failingPrintStream()) { + of(0).out(failingPrintStream); + } + }); } // -- PrintWriter @@ -2124,11 +2174,13 @@ public void shouldWriteToPrintWriter() { assertThat(sw.toString()).isEqualTo(of(1, 2, 3).mkString("", lineSeparator(), lineSeparator())); } - @Test(expected = IllegalStateException.class) + @Test public void shouldHandlePrintWriterIOException() { - try (PrintWriter failingPrintWriter = failingPrintWriter()) { - of(0).out(failingPrintWriter); - } + assertThrows(IllegalStateException.class, () -> { + try (PrintWriter failingPrintWriter = failingPrintWriter()) { + of(0).out(failingPrintWriter); + } + }); } // -- sum @@ -2138,9 +2190,9 @@ public void shouldComputeSumOfNil() { assertThat(empty().sum()).isEqualTo(0); } - @Test(expected = UnsupportedOperationException.class) + @Test public void shouldThrowWhenComputingSumOfStrings() { - of("1", "2", "3").sum(); + assertThrows(UnsupportedOperationException.class, () -> of("1", "2", "3").sum()); } @Test @@ -2351,9 +2403,9 @@ public void shouldReturnSameInstanceWhenEmptyTakeWhile() { // -- tail - @Test(expected = UnsupportedOperationException.class) + @Test public void shouldThrowWhenTailOnNil() { - empty().tail(); + assertThrows(UnsupportedOperationException.class, () -> empty().tail()); } @Test @@ -2422,24 +2474,21 @@ public void shouldZipNonEmptyAndNil() { @Test public void shouldZipNonNilsIfThisIsSmaller() { final Traversable> actual = of(1, 2).zip(of("a", "b", "c")); - @SuppressWarnings("unchecked") - final Traversable> expected = of(Tuple.of(1, "a"), Tuple.of(2, "b")); + @SuppressWarnings("unchecked") final Traversable> expected = of(Tuple.of(1, "a"), Tuple.of(2, "b")); assertThat(actual).isEqualTo(expected); } @Test public void shouldZipNonNilsIfThatIsSmaller() { final Traversable> actual = of(1, 2, 3).zip(of("a", "b")); - @SuppressWarnings("unchecked") - final Traversable> expected = of(Tuple.of(1, "a"), Tuple.of(2, "b")); + @SuppressWarnings("unchecked") final Traversable> expected = of(Tuple.of(1, "a"), Tuple.of(2, "b")); assertThat(actual).isEqualTo(expected); } @Test public void shouldZipNonNilsOfSameSize() { final Traversable> actual = of(1, 2, 3).zip(of("a", "b", "c")); - @SuppressWarnings("unchecked") - final Traversable> expected = of(Tuple.of(1, "a"), Tuple.of(2, "b"), Tuple.of(3, "c")); + @SuppressWarnings("unchecked") final Traversable> expected = of(Tuple.of(1, "a"), Tuple.of(2, "b"), Tuple.of(3, "c")); assertThat(actual).isEqualTo(expected); } @@ -2451,9 +2500,9 @@ public void shouldZipWithNonNilsOfSameSize() { assertThat(actual).isEqualTo(expected); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowIfZipWithThatIsNull() { - empty().zip(null); + assertThrows(NullPointerException.class, () -> empty().zip(null)); } // -- zipAll @@ -2481,30 +2530,27 @@ public void shouldZipAllNonEmptyAndNil() { @Test public void shouldZipAllNonNilsIfThisIsSmaller() { final Traversable> actual = of(1, 2).zipAll(of("a", "b", "c"), 9, "z"); - @SuppressWarnings("unchecked") - final Traversable> expected = of(Tuple.of(1, "a"), Tuple.of(2, "b"), Tuple.of(9, "c")); + @SuppressWarnings("unchecked") final Traversable> expected = of(Tuple.of(1, "a"), Tuple.of(2, "b"), Tuple.of(9, "c")); assertThat(actual).isEqualTo(expected); } @Test public void shouldZipAllNonNilsIfThatIsSmaller() { final Traversable> actual = of(1, 2, 3).zipAll(of("a", "b"), 9, "z"); - @SuppressWarnings("unchecked") - final Traversable> expected = of(Tuple.of(1, "a"), Tuple.of(2, "b"), Tuple.of(3, "z")); + @SuppressWarnings("unchecked") final Traversable> expected = of(Tuple.of(1, "a"), Tuple.of(2, "b"), Tuple.of(3, "z")); assertThat(actual).isEqualTo(expected); } @Test public void shouldZipAllNonNilsOfSameSize() { final Traversable> actual = of(1, 2, 3).zipAll(of("a", "b", "c"), 9, "z"); - @SuppressWarnings("unchecked") - final Traversable> expected = of(Tuple.of(1, "a"), Tuple.of(2, "b"), Tuple.of(3, "c")); + @SuppressWarnings("unchecked") final Traversable> expected = of(Tuple.of(1, "a"), Tuple.of(2, "b"), Tuple.of(3, "c")); assertThat(actual).isEqualTo(expected); } - @Test(expected = NullPointerException.class) + @Test public void shouldThrowIfZipAllWithThatIsNull() { - empty().zipAll(null, null, null); + assertThrows(NullPointerException.class, () -> empty().zipAll(null, null, null)); } // -- zipWithIndex @@ -2517,8 +2563,7 @@ public void shouldZipNilWithIndex() { @Test public void shouldZipNonNilWithIndex() { final Traversable> actual = of("a", "b", "c").zipWithIndex(); - @SuppressWarnings("unchecked") - final Traversable> expected = of(Tuple.of("a", 0), Tuple.of("b", 1), Tuple.of("c", 2)); + @SuppressWarnings("unchecked") final Traversable> expected = of(Tuple.of("a", 0), Tuple.of("b", 1), Tuple.of("c", 2)); assertThat(actual).isEqualTo(expected); } @@ -2534,15 +2579,15 @@ public void shouldZipNonNilWithIndexWithMapper() { @Test public void shouldConvertNilToJavaArray() { - final Integer[] actual = List. empty().toJavaArray(Integer[]::new); - final Integer[] expected = new Integer[] {}; + final Integer[] actual = List.empty().toJavaArray(Integer[]::new); + final Integer[] expected = new Integer[]{}; assertThat(actual).isEqualTo(expected); } @Test public void shouldConvertNonNilToJavaArray() { final Integer[] array = of(1, 2).toJavaArray(Integer[]::new); - final Integer[] expected = new Integer[] { 1, 2 }; + final Integer[] expected = new Integer[]{1, 2}; assertThat(array).isEqualTo(expected); } @@ -2550,7 +2595,7 @@ public void shouldConvertNonNilToJavaArray() { @Test public void shouldConvertNilToArrayList() { - assertThat(this. empty().toJavaList()).isEqualTo(new ArrayList()); + assertThat(this.empty().toJavaList()).isEqualTo(new ArrayList()); } @Test @@ -2562,7 +2607,7 @@ public void shouldConvertNonNilToArrayList() { @Test public void shouldConvertNilToHashMap() { - assertThat(this. empty().toJavaMap(x -> Tuple.of(x, x))).isEqualTo(new java.util.HashMap<>()); + assertThat(this.empty().toJavaMap(x -> Tuple.of(x, x))).isEqualTo(new java.util.HashMap<>()); } @Test @@ -2577,7 +2622,7 @@ public void shouldConvertNonNilToHashMap() { @Test public void shouldConvertNilToHashSet() { - assertThat(this. empty().toJavaSet()).isEqualTo(new java.util.HashSet<>()); + assertThat(this.empty().toJavaSet()).isEqualTo(new java.util.HashSet<>()); } @Test @@ -2595,14 +2640,14 @@ public void shouldConvertNonNilToHashSet() { public void shouldConvertToTree() { //Value["id:parent")] final Traversable value = of( - "1:", - "2:1", "3:1", - "4:2", "5:2", "6:3", - "7:4", "8:6", "9:6" + "1:", + "2:1", "3:1", + "4:2", "5:2", "6:3", + "7:4", "8:6", "9:6" ); final Seq> roots = value - .toTree(s -> s.split(":")[0], s -> s.split(":").length == 1 ? null : s.split(":")[1]) - .map(l -> l.map(s -> s.split(":")[0])); + .toTree(s -> s.split(":")[0], s -> s.split(":").length == 1 ? null : s.split(":")[1]) + .map(l -> l.map(s -> s.split(":")[0])); assertThat(roots).hasSize(1); final Tree root = roots.head(); if (value.hasDefiniteSize()) { @@ -2734,7 +2779,7 @@ public void shouldStreamAndCollectNil() { @Test public void shouldStreamAndCollectNonNil() { testCollector(() -> { - final Traversable actual = java.util.stream.Stream.of(1, 2, 3).collect(this. collector()); + final Traversable actual = java.util.stream.Stream.of(1, 2, 3).collect(this.collector()); assertThat(actual).isEqualTo(of(1, 2, 3)); }); } @@ -2750,21 +2795,22 @@ public void shouldParallelStreamAndCollectNil() { @Test public void shouldParallelStreamAndCollectNonNil() { testCollector(() -> { - final Traversable actual = java.util.stream.Stream.of(1, 2, 3).parallel().collect(this. collector()); + final Traversable actual = java.util.stream.Stream.of(1, 2, 3).parallel() + .collect(this.collector()); assertThat(actual).isEqualTo(of(1, 2, 3)); }); } // -- single - @Test(expected = NoSuchElementException.class) + @Test public void shouldSingleFailEmpty() { - empty().single(); + assertThrows(NoSuchElementException.class, () -> empty().single()); } - @Test(expected = NoSuchElementException.class) + @Test public void shouldSingleFailTwo() { - of(1, 2).single(); + assertThrows(NoSuchElementException.class, () -> of(1, 2).single()); } @Test @@ -2835,13 +2881,17 @@ public void shouldFillTheSeqWith0ElementsWhenNIsNegative() { @Test public void ofShouldReturnTheSingletonEmpty() { - if (!emptyShouldBeSingleton()) { return; } + if (!emptyShouldBeSingleton()) { + return; + } assertThat(of()).isSameAs(empty()); } @Test public void ofAllShouldReturnTheSingletonEmpty() { - if (!emptyShouldBeSingleton()) { return; } + if (!emptyShouldBeSingleton()) { + return; + } assertThat(ofAll(io.vavr.collection.Iterator.empty())).isSameAs(empty()); } diff --git a/vavr/src/test/java/io/vavr/collection/ArrayTest.java b/vavr/src/test/java/io/vavr/collection/ArrayTest.java index bd8a1225b9..2689937873 100644 --- a/vavr/src/test/java/io/vavr/collection/ArrayTest.java +++ b/vavr/src/test/java/io/vavr/collection/ArrayTest.java @@ -25,7 +25,7 @@ import io.vavr.collection.JavaConverters.ListView; import io.vavr.control.Option; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.ArrayList; diff --git a/vavr/src/test/java/io/vavr/collection/BitSetTest.java b/vavr/src/test/java/io/vavr/collection/BitSetTest.java index 9d228e5e3a..541714c9fe 100644 --- a/vavr/src/test/java/io/vavr/collection/BitSetTest.java +++ b/vavr/src/test/java/io/vavr/collection/BitSetTest.java @@ -7,7 +7,7 @@ import org.assertj.core.api.Assertions; import org.assertj.core.api.IterableAssert; import org.assertj.core.api.ObjectAssert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.Serializable; import java.util.ArrayList; diff --git a/vavr/src/test/java/io/vavr/collection/CharSeqTest.java b/vavr/src/test/java/io/vavr/collection/CharSeqTest.java index 2550117fb3..cfed75ff2e 100644 --- a/vavr/src/test/java/io/vavr/collection/CharSeqTest.java +++ b/vavr/src/test/java/io/vavr/collection/CharSeqTest.java @@ -26,7 +26,7 @@ import io.vavr.collection.JavaConverters.ListView; import io.vavr.control.Option; import org.assertj.core.api.*; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; diff --git a/vavr/src/test/java/io/vavr/collection/CollectionsTest.java b/vavr/src/test/java/io/vavr/collection/CollectionsTest.java index b01df50807..b4932479db 100644 --- a/vavr/src/test/java/io/vavr/collection/CollectionsTest.java +++ b/vavr/src/test/java/io/vavr/collection/CollectionsTest.java @@ -20,7 +20,7 @@ package io.vavr.collection; import io.vavr.Tuple; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/ComparatorsTest.java b/vavr/src/test/java/io/vavr/collection/ComparatorsTest.java index 4ab64b9778..1ffe66aa8a 100644 --- a/vavr/src/test/java/io/vavr/collection/ComparatorsTest.java +++ b/vavr/src/test/java/io/vavr/collection/ComparatorsTest.java @@ -1,6 +1,6 @@ package io.vavr.collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Comparator; diff --git a/vavr/src/test/java/io/vavr/collection/HashArrayMappedTrieTest.java b/vavr/src/test/java/io/vavr/collection/HashArrayMappedTrieTest.java index e7021a501c..819a8cafac 100644 --- a/vavr/src/test/java/io/vavr/collection/HashArrayMappedTrieTest.java +++ b/vavr/src/test/java/io/vavr/collection/HashArrayMappedTrieTest.java @@ -22,7 +22,7 @@ import io.vavr.Tuple; import io.vavr.Tuple2; import io.vavr.control.Option; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Random; import java.util.function.Function; diff --git a/vavr/src/test/java/io/vavr/collection/HashMapTest.java b/vavr/src/test/java/io/vavr/collection/HashMapTest.java index 426df76cf3..90dc2199e6 100644 --- a/vavr/src/test/java/io/vavr/collection/HashMapTest.java +++ b/vavr/src/test/java/io/vavr/collection/HashMapTest.java @@ -22,7 +22,7 @@ import io.vavr.Tuple2; import io.vavr.control.Option; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.ArrayList; diff --git a/vavr/src/test/java/io/vavr/collection/HashMultimapTest.java b/vavr/src/test/java/io/vavr/collection/HashMultimapTest.java index 31cf940350..72618b1681 100644 --- a/vavr/src/test/java/io/vavr/collection/HashMultimapTest.java +++ b/vavr/src/test/java/io/vavr/collection/HashMultimapTest.java @@ -2,7 +2,7 @@ import io.vavr.Tuple2; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.*; diff --git a/vavr/src/test/java/io/vavr/collection/HashSetTest.java b/vavr/src/test/java/io/vavr/collection/HashSetTest.java index 9cc348cc71..5e855ca668 100644 --- a/vavr/src/test/java/io/vavr/collection/HashSetTest.java +++ b/vavr/src/test/java/io/vavr/collection/HashSetTest.java @@ -23,7 +23,7 @@ import io.vavr.Value; import io.vavr.Tuple2; import org.assertj.core.api.*; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.ArrayList; diff --git a/vavr/src/test/java/io/vavr/collection/IntMod2Test.java b/vavr/src/test/java/io/vavr/collection/IntMod2Test.java index 726a24b6ca..6b3f32df12 100644 --- a/vavr/src/test/java/io/vavr/collection/IntMod2Test.java +++ b/vavr/src/test/java/io/vavr/collection/IntMod2Test.java @@ -19,7 +19,7 @@ */ package io.vavr.collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/IteratorTest.java b/vavr/src/test/java/io/vavr/collection/IteratorTest.java index c440f7eb94..bffeeeb268 100644 --- a/vavr/src/test/java/io/vavr/collection/IteratorTest.java +++ b/vavr/src/test/java/io/vavr/collection/IteratorTest.java @@ -27,7 +27,7 @@ import org.assertj.core.api.IterableAssert; import org.assertj.core.api.ObjectAssert; import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.ArrayList; diff --git a/vavr/src/test/java/io/vavr/collection/JavaConvertersTest.java b/vavr/src/test/java/io/vavr/collection/JavaConvertersTest.java index b413d52adc..12fe2c1ed1 100644 --- a/vavr/src/test/java/io/vavr/collection/JavaConvertersTest.java +++ b/vavr/src/test/java/io/vavr/collection/JavaConvertersTest.java @@ -20,7 +20,7 @@ package io.vavr.collection; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; diff --git a/vavr/src/test/java/io/vavr/collection/LinkedHashMapTest.java b/vavr/src/test/java/io/vavr/collection/LinkedHashMapTest.java index 39a3e41cf4..4cbebba836 100644 --- a/vavr/src/test/java/io/vavr/collection/LinkedHashMapTest.java +++ b/vavr/src/test/java/io/vavr/collection/LinkedHashMapTest.java @@ -3,7 +3,7 @@ import io.vavr.Tuple; import io.vavr.Tuple2; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.ArrayList; diff --git a/vavr/src/test/java/io/vavr/collection/LinkedHashMultimapTest.java b/vavr/src/test/java/io/vavr/collection/LinkedHashMultimapTest.java index d3aca69932..2b9c8599d9 100644 --- a/vavr/src/test/java/io/vavr/collection/LinkedHashMultimapTest.java +++ b/vavr/src/test/java/io/vavr/collection/LinkedHashMultimapTest.java @@ -2,7 +2,7 @@ import io.vavr.Tuple2; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.*; diff --git a/vavr/src/test/java/io/vavr/collection/LinkedHashSetTest.java b/vavr/src/test/java/io/vavr/collection/LinkedHashSetTest.java index d39fd54982..ba1c082c2e 100644 --- a/vavr/src/test/java/io/vavr/collection/LinkedHashSetTest.java +++ b/vavr/src/test/java/io/vavr/collection/LinkedHashSetTest.java @@ -2,7 +2,7 @@ import io.vavr.Value; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.ArrayList; diff --git a/vavr/src/test/java/io/vavr/collection/ListTest.java b/vavr/src/test/java/io/vavr/collection/ListTest.java index 69d96d974a..0a3c4ca1c2 100644 --- a/vavr/src/test/java/io/vavr/collection/ListTest.java +++ b/vavr/src/test/java/io/vavr/collection/ListTest.java @@ -24,7 +24,7 @@ import io.vavr.Value; import io.vavr.Tuple2; import io.vavr.control.Option; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.InvalidObjectException; import java.math.BigDecimal; diff --git a/vavr/src/test/java/io/vavr/collection/PriorityQueueTest.java b/vavr/src/test/java/io/vavr/collection/PriorityQueueTest.java index 5f00dc4d11..e4d9fd4a25 100644 --- a/vavr/src/test/java/io/vavr/collection/PriorityQueueTest.java +++ b/vavr/src/test/java/io/vavr/collection/PriorityQueueTest.java @@ -21,7 +21,7 @@ import io.vavr.Tuple; import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.*; diff --git a/vavr/src/test/java/io/vavr/collection/QueueTest.java b/vavr/src/test/java/io/vavr/collection/QueueTest.java index 38cf256948..ed9e6d114b 100644 --- a/vavr/src/test/java/io/vavr/collection/QueueTest.java +++ b/vavr/src/test/java/io/vavr/collection/QueueTest.java @@ -23,7 +23,7 @@ import io.vavr.Tuple; import io.vavr.Tuple2; import io.vavr.control.Option; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.ArrayList; diff --git a/vavr/src/test/java/io/vavr/collection/QuickSortTest.java b/vavr/src/test/java/io/vavr/collection/QuickSortTest.java index 7d881d11b0..af3bf707ac 100644 --- a/vavr/src/test/java/io/vavr/collection/QuickSortTest.java +++ b/vavr/src/test/java/io/vavr/collection/QuickSortTest.java @@ -20,7 +20,7 @@ package io.vavr.collection; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.function.IntFunction; diff --git a/vavr/src/test/java/io/vavr/collection/RedBlackTreeTest.java b/vavr/src/test/java/io/vavr/collection/RedBlackTreeTest.java index a1c26dfb34..cc4465b210 100644 --- a/vavr/src/test/java/io/vavr/collection/RedBlackTreeTest.java +++ b/vavr/src/test/java/io/vavr/collection/RedBlackTreeTest.java @@ -19,7 +19,7 @@ */ package io.vavr.collection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.NoSuchElementException; diff --git a/vavr/src/test/java/io/vavr/collection/StreamTest.java b/vavr/src/test/java/io/vavr/collection/StreamTest.java index 10f4b62d37..de55ab5dd8 100644 --- a/vavr/src/test/java/io/vavr/collection/StreamTest.java +++ b/vavr/src/test/java/io/vavr/collection/StreamTest.java @@ -23,7 +23,7 @@ import io.vavr.control.Option; import io.vavr.control.Try; import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.InvalidObjectException; import java.math.BigDecimal; diff --git a/vavr/src/test/java/io/vavr/collection/StringTest.java b/vavr/src/test/java/io/vavr/collection/StringTest.java index a3610d6fd4..51d23d72ac 100644 --- a/vavr/src/test/java/io/vavr/collection/StringTest.java +++ b/vavr/src/test/java/io/vavr/collection/StringTest.java @@ -20,7 +20,7 @@ package io.vavr.collection; import io.vavr.control.Option; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; diff --git a/vavr/src/test/java/io/vavr/collection/TreeMapTest.java b/vavr/src/test/java/io/vavr/collection/TreeMapTest.java index b5dc1f2f71..835e80fa0b 100644 --- a/vavr/src/test/java/io/vavr/collection/TreeMapTest.java +++ b/vavr/src/test/java/io/vavr/collection/TreeMapTest.java @@ -22,7 +22,7 @@ import io.vavr.Serializables; import io.vavr.Tuple; import io.vavr.Tuple2; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.ArrayList; diff --git a/vavr/src/test/java/io/vavr/collection/TreeMultimapTest.java b/vavr/src/test/java/io/vavr/collection/TreeMultimapTest.java index e5b53c9d69..a56274a040 100644 --- a/vavr/src/test/java/io/vavr/collection/TreeMultimapTest.java +++ b/vavr/src/test/java/io/vavr/collection/TreeMultimapTest.java @@ -2,7 +2,7 @@ import io.vavr.Tuple2; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.*; diff --git a/vavr/src/test/java/io/vavr/collection/TreeSetTest.java b/vavr/src/test/java/io/vavr/collection/TreeSetTest.java index 0761317f7c..5cf971f379 100644 --- a/vavr/src/test/java/io/vavr/collection/TreeSetTest.java +++ b/vavr/src/test/java/io/vavr/collection/TreeSetTest.java @@ -21,7 +21,7 @@ import io.vavr.Value; import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.util.ArrayList; diff --git a/vavr/src/test/java/io/vavr/collection/TreeTest.java b/vavr/src/test/java/io/vavr/collection/TreeTest.java index 62da2e9d08..aa8d2c2545 100644 --- a/vavr/src/test/java/io/vavr/collection/TreeTest.java +++ b/vavr/src/test/java/io/vavr/collection/TreeTest.java @@ -25,7 +25,7 @@ import org.assertj.core.api.IterableAssert; import org.assertj.core.api.ObjectAssert; import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.InvalidObjectException; import java.math.BigDecimal; diff --git a/vavr/src/test/java/io/vavr/collection/VectorPropertyTest.java b/vavr/src/test/java/io/vavr/collection/VectorPropertyTest.java index 3413a099c4..e25cb13268 100644 --- a/vavr/src/test/java/io/vavr/collection/VectorPropertyTest.java +++ b/vavr/src/test/java/io/vavr/collection/VectorPropertyTest.java @@ -22,7 +22,7 @@ import io.vavr.Function2; import io.vavr.Tuple2; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; import java.util.Random; diff --git a/vavr/src/test/java/io/vavr/collection/VectorTest.java b/vavr/src/test/java/io/vavr/collection/VectorTest.java index 6cdf6f9cb6..c5f5373847 100644 --- a/vavr/src/test/java/io/vavr/collection/VectorTest.java +++ b/vavr/src/test/java/io/vavr/collection/VectorTest.java @@ -25,7 +25,7 @@ import io.vavr.collection.JavaConverters.ChangePolicy; import io.vavr.collection.JavaConverters.ListView; import io.vavr.control.Option; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.InvalidObjectException; import java.math.BigDecimal; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler01Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler01Test.java index 38cb078c4c..d0922c6cad 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler01Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler01Test.java @@ -20,7 +20,7 @@ package io.vavr.collection.euler; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler02Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler02Test.java index e30aee9798..8634573aac 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler02Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler02Test.java @@ -19,7 +19,7 @@ */ package io.vavr.collection.euler; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigInteger; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler03Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler03Test.java index a5bd627a57..ad8185fe00 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler03Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler03Test.java @@ -19,7 +19,7 @@ */ package io.vavr.collection.euler; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler04Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler04Test.java index 52ab98ca38..e1a10cfbda 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler04Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler04Test.java @@ -20,7 +20,7 @@ package io.vavr.collection.euler; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler05Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler05Test.java index d54da95f52..4309e3d9ad 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler05Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler05Test.java @@ -20,7 +20,7 @@ package io.vavr.collection.euler; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler06Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler06Test.java index bd7627963c..4133f30ec9 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler06Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler06Test.java @@ -20,7 +20,7 @@ package io.vavr.collection.euler; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler07Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler07Test.java index 92681fe8ce..cb28b10edb 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler07Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler07Test.java @@ -20,7 +20,7 @@ package io.vavr.collection.euler; import io.vavr.collection.Array; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler08Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler08Test.java index 58e29c3435..3613570368 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler08Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler08Test.java @@ -21,7 +21,7 @@ import io.vavr.collection.Seq; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler09Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler09Test.java index 76fc81ff47..f44c8f7f01 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler09Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler09Test.java @@ -21,7 +21,7 @@ import io.vavr.Tuple; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler10Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler10Test.java index 58bf02e24b..1ed1e8dcec 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler10Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler10Test.java @@ -19,7 +19,7 @@ */ package io.vavr.collection.euler; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler11Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler11Test.java index 39b893ba9d..d7a0a103a0 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler11Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler11Test.java @@ -24,7 +24,7 @@ import io.vavr.collection.Seq; import io.vavr.collection.Stream; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler12Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler12Test.java index 607fa9a83d..1ed26a93ba 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler12Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler12Test.java @@ -20,7 +20,7 @@ package io.vavr.collection.euler; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.collection.euler.Utils.factors; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler13Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler13Test.java index 467b0c45f9..4921585c34 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler13Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler13Test.java @@ -19,7 +19,7 @@ */ package io.vavr.collection.euler; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigInteger; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler14Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler14Test.java index 5367c2fc43..3299b0c6d4 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler14Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler14Test.java @@ -22,7 +22,7 @@ import io.vavr.Function1; import io.vavr.collection.Stream; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler15Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler15Test.java index 2841d12256..0629d60fe9 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler15Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler15Test.java @@ -19,7 +19,7 @@ */ package io.vavr.collection.euler; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigInteger; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler16Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler16Test.java index 672b7cdb1e..bf44657ca3 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler16Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler16Test.java @@ -20,7 +20,7 @@ package io.vavr.collection.euler; import io.vavr.collection.CharSeq; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigInteger; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler17Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler17Test.java index 321740475b..7a60ffe51c 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler17Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler17Test.java @@ -25,7 +25,7 @@ import io.vavr.Tuple2; import io.vavr.collection.List; import io.vavr.collection.Vector; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.API.*; import static io.vavr.collection.Stream.rangeClosed; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler18Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler18Test.java index 96948133c8..df7222cdd4 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler18Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler18Test.java @@ -21,7 +21,7 @@ import io.vavr.Function3; import io.vavr.collection.Vector; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler19Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler19Test.java index 3c33666025..2ba30b1560 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler19Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler19Test.java @@ -21,7 +21,7 @@ import io.vavr.Tuple; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.time.DayOfWeek; import java.time.LocalDate; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler20Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler20Test.java index da29d76319..e65f25d04d 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler20Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler20Test.java @@ -21,7 +21,7 @@ import io.vavr.collection.CharSeq; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigInteger; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler21Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler21Test.java index eab996460c..06785a6a92 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler21Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler21Test.java @@ -22,7 +22,7 @@ import io.vavr.Function1; import io.vavr.Tuple; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Objects; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler22Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler22Test.java index e4287a0e45..c84c36ae7c 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler22Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler22Test.java @@ -21,7 +21,7 @@ import io.vavr.collection.CharSeq; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.collection.euler.Utils.file; import static io.vavr.collection.euler.Utils.readLines; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler23Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler23Test.java index f50b52b7c5..bd3c1a72ba 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler23Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler23Test.java @@ -23,7 +23,7 @@ import io.vavr.collection.List; import io.vavr.collection.Stream; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.API.*; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler24Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler24Test.java index dd30995ec0..f6cdb27f7b 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler24Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler24Test.java @@ -22,7 +22,7 @@ import io.vavr.Function1; import io.vavr.API; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.API.$; import static io.vavr.API.Case; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler25Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler25Test.java index 0fa4664134..6a4cdfaf40 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler25Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler25Test.java @@ -19,7 +19,7 @@ */ package io.vavr.collection.euler; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.collection.euler.Utils.fibonacci; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler26Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler26Test.java index f65ad7dc73..3d90805466 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler26Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler26Test.java @@ -26,7 +26,7 @@ import io.vavr.collection.List; import io.vavr.collection.Stream; import io.vavr.control.Option; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; import java.math.RoundingMode; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler27Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler27Test.java index 875baa2c01..b8d230a9c2 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler27Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler27Test.java @@ -23,7 +23,7 @@ import io.vavr.Tuple; import io.vavr.collection.List; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.API.For; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler28Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler28Test.java index d54cb158da..dfb3c8cda1 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler28Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler28Test.java @@ -21,7 +21,7 @@ import io.vavr.Tuple; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler29Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler29Test.java index 4ae33cff45..723c6e1ddb 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler29Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler29Test.java @@ -20,7 +20,7 @@ package io.vavr.collection.euler; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigInteger; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler30Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler30Test.java index a56f40b16d..83ec6e15e7 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler30Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler30Test.java @@ -23,7 +23,7 @@ import io.vavr.collection.CharSeq; import io.vavr.collection.List; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler31Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler31Test.java index 734410ea00..7479c165d1 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler31Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler31Test.java @@ -20,7 +20,7 @@ package io.vavr.collection.euler; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler32Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler32Test.java index 3594ebf3c6..46276b2884 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler32Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler32Test.java @@ -23,7 +23,7 @@ import io.vavr.collection.CharSeq; import io.vavr.Tuple3; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler33Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler33Test.java index 05d7f59c22..1ae38b5eef 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler33Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler33Test.java @@ -23,7 +23,7 @@ import io.vavr.collection.CharSeq; import io.vavr.Tuple2; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.collection.euler.Utils.factors; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler34Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler34Test.java index fa6b6b43eb..da812b14ea 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler34Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler34Test.java @@ -21,7 +21,7 @@ import io.vavr.collection.CharSeq; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.collection.euler.Utils.MEMOIZED_FACTORIAL; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler35Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler35Test.java index 5ed63eee9f..adb80d5941 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler35Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler35Test.java @@ -23,7 +23,7 @@ import io.vavr.collection.CharSeq; import io.vavr.collection.Stream; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.function.Predicate; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler36Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler36Test.java index 48e77c08c3..01bfb309f8 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler36Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler36Test.java @@ -21,7 +21,7 @@ import io.vavr.collection.CharSeq; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler37Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler37Test.java index 9987b9e120..ad6837abbd 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler37Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler37Test.java @@ -21,7 +21,7 @@ import io.vavr.collection.CharSeq; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.API.*; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler38Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler38Test.java index f16179f201..26aadbf6f5 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler38Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler38Test.java @@ -21,7 +21,7 @@ import io.vavr.collection.CharSeq; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.API.*; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler39Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler39Test.java index 4bec19f9d3..786ed4f8e0 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler39Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler39Test.java @@ -24,7 +24,7 @@ import io.vavr.Tuple2; import io.vavr.Tuple3; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static java.lang.Math.floor; import static java.lang.Math.hypot; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler40Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler40Test.java index e7a5fc8876..25a3845d5d 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler40Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler40Test.java @@ -21,7 +21,7 @@ import io.vavr.collection.CharSeq; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler41Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler41Test.java index eabf0b902e..32534ac67d 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler41Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler41Test.java @@ -21,7 +21,7 @@ import io.vavr.collection.Stream; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static java.util.Comparator.reverseOrder; import static io.vavr.collection.euler.Utils.isPrime; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler42Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler42Test.java index bad91c1ad1..aab69a47c7 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler42Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler42Test.java @@ -24,7 +24,7 @@ import io.vavr.collection.List; import io.vavr.collection.Stream; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static io.vavr.collection.euler.Utils.file; import static io.vavr.collection.euler.Utils.readLines; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler43Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler43Test.java index 2669bd4aa8..ff37bb4ed2 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler43Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler43Test.java @@ -23,7 +23,7 @@ import io.vavr.collection.Seq; import io.vavr.collection.List; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler45Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler45Test.java index 15634093ce..99a2987c4e 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler45Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler45Test.java @@ -22,7 +22,7 @@ import io.vavr.collection.Stream; import io.vavr.collection.List; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler48Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler48Test.java index 79dc7217fe..847e692a28 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler48Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler48Test.java @@ -20,7 +20,7 @@ package io.vavr.collection.euler; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler55Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler55Test.java index 195c0874d1..dc9f58ce6b 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler55Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler55Test.java @@ -21,7 +21,7 @@ import io.vavr.collection.Stream; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigInteger; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler57Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler57Test.java index af7d7ad027..d0a8e9d41d 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler57Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler57Test.java @@ -22,7 +22,7 @@ import io.vavr.Tuple; import io.vavr.collection.Stream; import io.vavr.Tuple2; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler67Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler67Test.java index b14eaf76e5..111fd9c4ae 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler67Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler67Test.java @@ -21,7 +21,7 @@ import io.vavr.Function3; import io.vavr.collection.Vector; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler71Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler71Test.java index e9afa25ab9..6c5979ba9c 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler71Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler71Test.java @@ -22,7 +22,7 @@ import io.vavr.Tuple; import io.vavr.Tuple4; import io.vavr.collection.Stream; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/vavr/src/test/java/io/vavr/collection/euler/Euler99Test.java b/vavr/src/test/java/io/vavr/collection/euler/Euler99Test.java index e599c20b6d..f0101198a6 100644 --- a/vavr/src/test/java/io/vavr/collection/euler/Euler99Test.java +++ b/vavr/src/test/java/io/vavr/collection/euler/Euler99Test.java @@ -19,7 +19,7 @@ */ package io.vavr.collection.euler; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static java.util.Arrays.asList; import static io.vavr.collection.euler.Utils.file; diff --git a/vavr/src/test/java/io/vavr/concurrent/FutureTest.java b/vavr/src/test/java/io/vavr/concurrent/FutureTest.java index 8af446feea..9e48e26765 100644 --- a/vavr/src/test/java/io/vavr/concurrent/FutureTest.java +++ b/vavr/src/test/java/io/vavr/concurrent/FutureTest.java @@ -29,7 +29,7 @@ import org.assertj.core.api.IterableAssert; import org.junit.AfterClass; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.TestRule; import org.junit.rules.TestWatcher; import org.junit.runner.Description; diff --git a/vavr/src/test/java/io/vavr/concurrent/PromiseTest.java b/vavr/src/test/java/io/vavr/concurrent/PromiseTest.java index e2ab294f28..5ec33488c6 100644 --- a/vavr/src/test/java/io/vavr/concurrent/PromiseTest.java +++ b/vavr/src/test/java/io/vavr/concurrent/PromiseTest.java @@ -21,7 +21,7 @@ import io.vavr.control.Try; import org.junit.AfterClass; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.concurrent.TimeoutException; diff --git a/vavr/src/test/java/io/vavr/control/EitherLeftProjectionTest.java b/vavr/src/test/java/io/vavr/control/EitherLeftProjectionTest.java index 6e2c430b6c..9d8eff07bd 100644 --- a/vavr/src/test/java/io/vavr/control/EitherLeftProjectionTest.java +++ b/vavr/src/test/java/io/vavr/control/EitherLeftProjectionTest.java @@ -23,7 +23,7 @@ import io.vavr.AbstractValueTest; import io.vavr.Tuple; import io.vavr.Tuple2; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.*; diff --git a/vavr/src/test/java/io/vavr/control/EitherRightProjectionTest.java b/vavr/src/test/java/io/vavr/control/EitherRightProjectionTest.java index aa963f99d3..ab6fa4c7e2 100644 --- a/vavr/src/test/java/io/vavr/control/EitherRightProjectionTest.java +++ b/vavr/src/test/java/io/vavr/control/EitherRightProjectionTest.java @@ -23,7 +23,7 @@ import io.vavr.AbstractValueTest; import io.vavr.Tuple; import io.vavr.Tuple2; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.*; diff --git a/vavr/src/test/java/io/vavr/control/EitherTest.java b/vavr/src/test/java/io/vavr/control/EitherTest.java index d750ebff24..86d25cd83d 100644 --- a/vavr/src/test/java/io/vavr/control/EitherTest.java +++ b/vavr/src/test/java/io/vavr/control/EitherTest.java @@ -23,7 +23,7 @@ import io.vavr.collection.Seq; import io.vavr.collection.List; import io.vavr.collection.Vector; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.NoSuchElementException; import java.util.Objects; diff --git a/vavr/src/test/java/io/vavr/control/OptionTest.java b/vavr/src/test/java/io/vavr/control/OptionTest.java index bbf0000dc6..c6448d559c 100644 --- a/vavr/src/test/java/io/vavr/control/OptionTest.java +++ b/vavr/src/test/java/io/vavr/control/OptionTest.java @@ -26,7 +26,7 @@ import io.vavr.PartialFunction; import io.vavr.Serializables; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.*; import java.util.List; diff --git a/vavr/src/test/java/io/vavr/control/TryTest.java b/vavr/src/test/java/io/vavr/control/TryTest.java index 54baefcb35..1c356228de 100644 --- a/vavr/src/test/java/io/vavr/control/TryTest.java +++ b/vavr/src/test/java/io/vavr/control/TryTest.java @@ -29,7 +29,7 @@ import org.assertj.core.api.Assertions; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.lang.reflect.Proxy; diff --git a/vavr/src/test/java/io/vavr/control/ValidationTest.java b/vavr/src/test/java/io/vavr/control/ValidationTest.java index d7e5129413..3a3c9c127b 100644 --- a/vavr/src/test/java/io/vavr/control/ValidationTest.java +++ b/vavr/src/test/java/io/vavr/control/ValidationTest.java @@ -24,7 +24,7 @@ import io.vavr.collection.CharSeq; import io.vavr.collection.Seq; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Objects; diff --git a/vavr/src/test/java/io/vavr/issues/Issue2559Test.java b/vavr/src/test/java/io/vavr/issues/Issue2559Test.java index 8a11b2dbc1..e4334e51ba 100644 --- a/vavr/src/test/java/io/vavr/issues/Issue2559Test.java +++ b/vavr/src/test/java/io/vavr/issues/Issue2559Test.java @@ -4,7 +4,7 @@ import io.vavr.collection.HashSet; import io.vavr.collection.Set; import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Objects; diff --git a/vavr/src/test/java/outside_of_vavr/IllegalAccessErrorTest.java b/vavr/src/test/java/outside_of_vavr/IllegalAccessErrorTest.java index 7859ffae13..8c47af2c33 100644 --- a/vavr/src/test/java/outside_of_vavr/IllegalAccessErrorTest.java +++ b/vavr/src/test/java/outside_of_vavr/IllegalAccessErrorTest.java @@ -23,7 +23,7 @@ import io.vavr.collection.BitSet; import io.vavr.collection.HashMap; import io.vavr.collection.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.function.BiFunction;