@@ -2627,7 +2627,7 @@ def generateTestClasses(): Unit = {
26272627 genVavrFile(" io.vavr" , s " APITest " , baseDir = TARGET_TEST )((im : ImportManager , packageName, className) => {
26282628
26292629 val assertThat = im.getStatic(" org.assertj.core.api.Assertions.assertThat" )
2630- val test = im.getType(" org.junit.Test" )
2630+ val test = im.getType(" org.junit.jupiter.api. Test" )
26312631
26322632 val API = im.getType(" io.vavr.API" )
26332633 val AssertionsExtensions = im.getType(" io.vavr.AssertionsExtensions" )
@@ -2844,7 +2844,7 @@ def generateTestClasses(): Unit = {
28442844
28452845 def genShortcutsTests (im : ImportManager , packageName : String , className : String ): String = {
28462846
2847- val fail = im.getStatic(" org.junit.Assert .fail" )
2847+ val fail = im.getStatic(" org.junit.jupiter.api.Assertions .fail" )
28482848 val captureStdOut = im.getStatic(" io.vavr.OutputTester.captureStdOut" )
28492849
28502850 xs """
@@ -3090,7 +3090,8 @@ def generateTestClasses(): Unit = {
30903090 val functionArgs = (1 to i).gen(j => s " o $j" )(" , " )
30913091 val generics = (1 to i + 1 ).gen(j => " Object" )(" , " )
30923092
3093- val test = im.getType(" org.junit.Test" )
3093+ val test = im.getType(" org.junit.jupiter.api.Test" )
3094+ val assertThrows = im.getStatic(" org.junit.jupiter.api.Assertions.assertThrows" )
30943095 val assertThat = im.getStatic(" org.assertj.core.api.Assertions.assertThat" )
30953096 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; "
30963097
@@ -3315,11 +3316,13 @@ def generateTestClasses(): Unit = {
33153316 assertThat(md5.getDigestLength()).isEqualTo(16);
33163317 }
33173318
3318- @ $test(expected = ${im.getType( " java.security.NoSuchAlgorithmException " )} .class)
3319+ @ $test
33193320 public void shouldThrowCheckedExceptionWhenUnchecked() {
3320- $name$i<MessageDigest> digest = () -> ${im.getType(" java.security.MessageDigest" )}.getInstance("Unknown");
3321- Function $i<MessageDigest> unchecked = digest.unchecked();
3322- unchecked.apply(); // Look ma, we throw an undeclared checked exception!
3321+ $assertThrows( ${im.getType(" java.security.NoSuchAlgorithmException" )}.class, () -> {
3322+ $name$i<MessageDigest> digest = () -> ${im.getType(" java.security.MessageDigest" )}.getInstance("Unknown");
3323+ Function $i<MessageDigest> unchecked = digest.unchecked();
3324+ unchecked.apply(); // Look ma, we throw an undeclared checked exception!
3325+ });
33233326 }
33243327
33253328 @ $test
@@ -3381,10 +3384,12 @@ def generateTestClasses(): Unit = {
33813384 assertThat(md5.getDigestLength()).isEqualTo(16);
33823385 }
33833386
3384- @ $test(expected = ${im.getType( " java.security.NoSuchAlgorithmException " )} .class)
3387+ @ $test
33853388 public void shouldUncheckedThrowIllegalState() {
3386- final Function $i< ${(1 to i).gen(j => " String" )(" , " )}, MessageDigest> unchecked = digest.unchecked();
3387- unchecked.apply( ${toArgList(" Unknown" )}); // Look ma, we throw an undeclared checked exception!
3389+ $assertThrows( ${im.getType(" java.security.NoSuchAlgorithmException" )}.class, () -> {
3390+ final Function $i< ${(1 to i).gen(j => " String" )(" , " )}, MessageDigest> unchecked = digest.unchecked();
3391+ unchecked.apply( ${toArgList(" Unknown" )}); // Look ma, we throw an undeclared checked exception!
3392+ });
33883393 }
33893394
33903395 @ $test
@@ -3464,7 +3469,7 @@ def generateTestClasses(): Unit = {
34643469 def genAllArity (im : ImportManager ,
34653470 mapName : String , mapBuilder : String ,
34663471 builderComparator : Boolean , keyComparator : Boolean ): String = {
3467- val test = im.getType(" org.junit.Test" )
3472+ val test = im.getType(" org.junit.jupiter.api. Test" )
34683473 val assertThat = im.getStatic(" org.assertj.core.api.Assertions.assertThat" )
34693474 val naturalComparator = if (builderComparator || keyComparator) im.getStatic(s " io.vavr.collection.Comparators.naturalComparator " ) else null
34703475 val map = im.getType(s " io.vavr.collection. $mapName" )
@@ -3523,7 +3528,7 @@ def generateTestClasses(): Unit = {
35233528
35243529 genVavrFile(" io.vavr" , s " Tuple ${i}Test " , baseDir = TARGET_TEST )((im : ImportManager , packageName, className) => {
35253530
3526- val test = im.getType(" org.junit.Test" )
3531+ val test = im.getType(" org.junit.jupiter.api. Test" )
35273532 val seq = im.getType(" io.vavr.collection.Seq" )
35283533 val list = im.getType(" io.vavr.collection.List" )
35293534 val stream = if (i == 0 ) " " else im.getType(" io.vavr.collection.Stream" )
0 commit comments