1010import static org .junit .jupiter .api .Assertions .assertAll ;
1111import static org .junit .jupiter .api .Assertions .assertEquals ;
1212import static org .junit .jupiter .api .Assertions .assertTrue ;
13- import static org .junitpioneer .jupiter .cartesian .CartesianTest .Enum ;
14- import static org .junitpioneer .jupiter .cartesian .CartesianTest .Values ;
1513import static org .mockito .ArgumentMatchers .any ;
1614import static org .mockito .ArgumentMatchers .anyInt ;
1715import static org .mockito .Mockito .inOrder ;
5856import org .junit .jupiter .params .provider .CsvSource ;
5957import org .junit .jupiter .params .provider .EnumSource ;
6058import org .junit .jupiter .params .provider .ValueSource ;
61- import org .junitpioneer .jupiter .cartesian .CartesianTest ;
6259import org .mockito .ArgumentCaptor ;
6360import org .mockito .InOrder ;
6461import org .mockito .Mock ;
@@ -137,9 +134,15 @@ void lookupAsync_absoluteQuery() throws InterruptedException, ExecutionException
137134 verify (mockResolver ).sendAsync (any (), any (Executor .class ));
138135 }
139136
140- @ CartesianTest (name = "useCache={0}, irrelevantRecordMode={1}" )
141- void lookupAsync_absoluteQueryNoExtra (
142- @ Values (booleans = {true , false }) boolean useCache , @ Enum IrrelevantRecordMode mode )
137+ @ ParameterizedTest
138+ @ CsvSource (
139+ value = {
140+ "true,REMOVE" ,
141+ "true,THROW" ,
142+ "false,REMOVE" ,
143+ "false,THROW" ,
144+ })
145+ void lookupAsync_absoluteQueryNoExtra (boolean useCache , IrrelevantRecordMode mode )
143146 throws ExecutionException , InterruptedException {
144147 wireUpMockResolver (
145148 mockResolver , query -> multiAnswer (query , name -> new Record [] {LOOPBACK_A , EXAMPLE_A }));
@@ -493,11 +496,20 @@ void lookupAsync_twoCnameRedirectMultipleQueries(boolean useCache) throws Except
493496 verify (mockResolver , times (3 )).sendAsync (any (), any (Executor .class ));
494497 }
495498
496- @ CartesianTest (name = "useCache={0}, includeSyntheticCnames={1}, irrelevantRecordMode={2}" )
499+ @ ParameterizedTest
500+ @ CsvSource (
501+ value = {
502+ "true,true,REMOVE" ,
503+ "true,true,THROW" ,
504+ "true,false,REMOVE" ,
505+ "true,false,THROW" ,
506+ "false,false,REMOVE" ,
507+ "false,false,THROW" ,
508+ "false,true,REMOVE" ,
509+ "false,true,THROW" ,
510+ })
497511 void lookupAsync_twoDnameRedirectOneQuery (
498- @ Values (booleans = {true , false }) boolean useCache ,
499- @ Values (booleans = {true , false }) boolean includeSyntheticCnames ,
500- @ Enum IrrelevantRecordMode mode )
512+ boolean useCache , boolean includeSyntheticCnames , IrrelevantRecordMode mode )
501513 throws Exception {
502514 wireUpMockResolver (
503515 mockResolver ,
@@ -738,9 +750,15 @@ void lookupAsync_dnameQuery() throws Exception {
738750 verify (mockResolver , times (1 )).sendAsync (any (), any (Executor .class ));
739751 }
740752
741- @ CartesianTest (name = "useCache={0}, irrelevantRecordMode={1}" )
742- void lookupAsync_cnameQueryExtra (
743- @ Values (booleans = {true , false }) boolean useCache , @ Enum IrrelevantRecordMode mode )
753+ @ ParameterizedTest
754+ @ CsvSource (
755+ value = {
756+ "true,REMOVE" ,
757+ "true,THROW" ,
758+ "false,REMOVE" ,
759+ "false,THROW" ,
760+ })
761+ void lookupAsync_cnameQueryExtra (boolean useCache , IrrelevantRecordMode mode )
744762 throws ExecutionException , InterruptedException {
745763 Name query = name ("cname.r." );
746764 Name target = name ("a.b." );
@@ -769,9 +787,15 @@ void lookupAsync_cnameQueryExtra(
769787 verify (mockResolver , times (1 )).sendAsync (any (), any (Executor .class ));
770788 }
771789
772- @ CartesianTest (name = "useCache={0}, irrelevantRecordMode={1}" )
773- void lookupAsync_dnameQueryExtra (
774- @ Values (booleans = {true , false }) boolean useCache , @ Enum IrrelevantRecordMode mode )
790+ @ ParameterizedTest
791+ @ CsvSource (
792+ value = {
793+ "true,REMOVE" ,
794+ "true,THROW" ,
795+ "false,REMOVE" ,
796+ "false,THROW" ,
797+ })
798+ void lookupAsync_dnameQueryExtra (boolean useCache , IrrelevantRecordMode mode )
775799 throws ExecutionException , InterruptedException {
776800 Name query = name ("cname.r." );
777801 Name target = name ("a.b." );
@@ -889,9 +913,15 @@ void lookupAsync_simpleDnameRedirectWrongSynthesizedCname(
889913 verify (mockResolver , times (1 )).sendAsync (any (), any (Executor .class ));
890914 }
891915
892- @ CartesianTest (name = "useCache={0}, irrelevantRecordMode={1}" )
893- void lookupAsync_simpleDnameRedirectNoExtra (
894- @ Values (booleans = {true , false }) boolean useCache , @ Enum IrrelevantRecordMode mode )
916+ @ ParameterizedTest
917+ @ CsvSource (
918+ value = {
919+ "true,REMOVE" ,
920+ "true,THROW" ,
921+ "false,REMOVE" ,
922+ "false,THROW" ,
923+ })
924+ void lookupAsync_simpleDnameRedirectNoExtra (boolean useCache , IrrelevantRecordMode mode )
895925 throws ExecutionException , InterruptedException {
896926 Name queryName = name ("x.y.to.dname." );
897927 wireUpMockResolver (
@@ -935,9 +965,15 @@ void lookupAsync_simpleDnameRedirectNoExtra(
935965 verify (mockResolver , times (2 )).sendAsync (any (), any (Executor .class ));
936966 }
937967
938- @ CartesianTest (name = "useCache={0}, irrelevantRecordMode={1}" )
939- void lookupAsync_simpleCnameWrongInitial (
940- @ Values (booleans = {true , false }) boolean useCache , @ Enum IrrelevantRecordMode mode )
968+ @ ParameterizedTest
969+ @ CsvSource (
970+ value = {
971+ "true,REMOVE" ,
972+ "true,THROW" ,
973+ "false,REMOVE" ,
974+ "false,THROW" ,
975+ })
976+ void lookupAsync_simpleCnameWrongInitial (boolean useCache , IrrelevantRecordMode mode )
941977 throws ExecutionException , InterruptedException {
942978 Name query = name ("first.example.com." );
943979 wireUpMockResolver (mockResolver , q -> answer (q , name -> cname ("a." , "b." )));
@@ -961,9 +997,15 @@ void lookupAsync_simpleCnameWrongInitial(
961997 verify (mockResolver , times (1 )).sendAsync (any (), any (Executor .class ));
962998 }
963999
964- @ CartesianTest (name = "useCache={0}, irrelevantRecordMode={1}" )
965- void lookupAsync_simpleDnameWrongInitial (
966- @ Values (booleans = {true , false }) boolean useCache , @ Enum IrrelevantRecordMode mode )
1000+ @ ParameterizedTest
1001+ @ CsvSource (
1002+ value = {
1003+ "true,REMOVE" ,
1004+ "true,THROW" ,
1005+ "false,REMOVE" ,
1006+ "false,THROW" ,
1007+ })
1008+ void lookupAsync_simpleDnameWrongInitial (boolean useCache , IrrelevantRecordMode mode )
9671009 throws ExecutionException , InterruptedException {
9681010 Name query = name ("first.example.com." );
9691011 wireUpMockResolver (mockResolver , q -> answer (q , name -> dname ("a." , "b." )));
@@ -1000,9 +1042,15 @@ private static void assertCacheUnused(
10001042 }
10011043 }
10021044
1003- @ CartesianTest (name = "maxRedirects={0}, irrelevantRecordMode={1}" )
1004- void lookupAsync_redirectLoop (
1005- @ Values (ints = {3 , 4 }) int maxRedirects , @ Enum IrrelevantRecordMode mode ) {
1045+ @ ParameterizedTest
1046+ @ CsvSource (
1047+ value = {
1048+ "3,REMOVE" ,
1049+ "3,THROW" ,
1050+ "4,REMOVE" ,
1051+ "4,THROW" ,
1052+ })
1053+ void lookupAsync_redirectLoop (int maxRedirects , IrrelevantRecordMode mode ) {
10061054 CNAMERecord cnameA = cname ("a." , "b." );
10071055 CNAMERecord cnameB = cname ("b." , "c." );
10081056 CNAMERecord cnameC = cname ("c." , "d." );
0 commit comments