2222import com .fasterxml .jackson .databind .Module ;
2323import com .google .common .collect .ImmutableList ;
2424import com .google .common .collect .ImmutableMap ;
25- import junitparams .JUnitParamsRunner ;
26- import junitparams .Parameters ;
27- import junitparams .naming .TestCaseName ;
2825import org .apache .druid .data .input .impl .DimensionSchema ;
2926import org .apache .druid .data .input .impl .DimensionsSpec ;
3027import org .apache .druid .data .input .impl .LongDimensionSchema ;
5754import org .apache .druid .segment .nested .StructuredData ;
5855import org .apache .druid .segment .virtual .NestedFieldVirtualColumn ;
5956import org .apache .druid .testing .InitializedNullHandlingTest ;
60- import org .junit .After ;
6157import org .junit .Assert ;
62- import org .junit .Assume ;
6358import org .junit .Rule ;
64- import org .junit .Test ;
59+ import org .junit .jupiter .api .AfterEach ;
60+ import org .junit .jupiter .api .Assumptions ;
61+ import org .junit .jupiter .api .Test ;
62+ import org .junit .jupiter .migrationsupport .EnableJUnit4MigrationSupport ;
63+ import org .junit .jupiter .params .ParameterizedTest ;
64+ import org .junit .jupiter .params .provider .MethodSource ;
65+ import org .junit .jupiter .params .provider .ValueSource ;
6566import org .junit .rules .TemporaryFolder ;
66- import org .junit .runner .RunWith ;
6767
6868import java .io .IOException ;
6969import java .util .ArrayList ;
7070import java .util .List ;
7171import java .util .stream .Collectors ;
7272import java .util .stream .Stream ;
7373
74- @ RunWith ( JUnitParamsRunner . class )
74+ @ EnableJUnit4MigrationSupport
7575public class NestedDataScanQueryTest extends InitializedNullHandlingTest
7676{
7777 private static final Logger LOG = new Logger (NestedDataScanQueryTest .class );
7878
7979 DefaultColumnFormatConfig DEFAULT_FORMAT = new DefaultColumnFormatConfig (null , null , null );
8080
81- private final AggregationTestHelper helper ;
82- private final Closer closer ;
83-
8481 @ Rule
8582 public final TemporaryFolder tempFolder = new TemporaryFolder ();
8683
84+ private final AggregationTestHelper helper ;
85+ private final Closer closer ;
86+
8787 public static Object [] getNestedColumnFormatSpec ()
8888 {
8989 List <Object > specs = new ArrayList <>();
@@ -113,7 +113,7 @@ public static Object[] getNestedColumnFormatSpec()
113113 return specs .toArray ();
114114 }
115115
116- @ After
116+ @ AfterEach
117117 public void teardown () throws IOException
118118 {
119119 closer .close ();
@@ -147,9 +147,8 @@ public void testIngestAndScanSegmentsSimple() throws Exception
147147 logResults (results );
148148 }
149149
150- @ Test
151- @ Parameters (method = "getNestedColumnFormatSpec" )
152- @ TestCaseName ("{0}" )
150+ @ ParameterizedTest (name = "{0}" )
151+ @ MethodSource ("getNestedColumnFormatSpec" )
153152 public void testIngestAndScanSegmentsWithSpec (String name , boolean auto , NestedCommonFormatColumnFormatSpec spec )
154153 throws Exception
155154 {
@@ -180,9 +179,8 @@ public void testIngestAndScanSegmentsWithSpec(String name, boolean auto, NestedC
180179 logResults (results );
181180 }
182181
183- @ Test
184- @ Parameters (method = "getNestedColumnFormatSpec" )
185- @ TestCaseName ("{0}" )
182+ @ ParameterizedTest (name = "{0}" )
183+ @ MethodSource ("getNestedColumnFormatSpec" )
186184 public void testIngestAndScanSegmentsNumericWithSpec (
187185 String name ,
188186 boolean auto ,
@@ -233,9 +231,9 @@ public void testIngestAndScanSegmentsNumericWithSpec(
233231 }
234232 }
235233
236- @ Test
237- @ Parameters ({ " true" , " false" })
238- public void testIngestAndScanSegmentsNumericRollup (boolean rollup ) throws Exception
234+ @ ParameterizedTest
235+ @ ValueSource ( booleans = { true , false })
236+ public void testIngestAndScanSegmentsNumericRollup (Boolean rollup ) throws Exception
239237 {
240238 Query <ScanResultValue > scanQuery = queryBuilder ()
241239 .virtualColumns (new NestedFieldVirtualColumn ("nest" , "$.long" , "long" ))
@@ -326,9 +324,8 @@ public void testIngestAndScanSegmentsRealtimeWithFallback() throws Exception
326324 Assert .assertEquals (resultsRealtime .get (0 ).getEvents ().toString (), resultsSegments .get (0 ).getEvents ().toString ());
327325 }
328326
329- @ Test
330- @ Parameters (method = "getNestedColumnFormatSpec" )
331- @ TestCaseName ("{0}" )
327+ @ ParameterizedTest (name = "{0}" )
328+ @ MethodSource ("getNestedColumnFormatSpec" )
332329 public void testIngestAndScanSegmentsTsv (String name , boolean auto , NestedCommonFormatColumnFormatSpec spec )
333330 throws Exception
334331 {
@@ -403,9 +400,8 @@ public void testIngestWithMoreMergesAndScanSegmentsRollup() throws Exception
403400 logResults (results );
404401 }
405402
406- @ Test
407- @ Parameters (method = "getNestedColumnFormatSpec" )
408- @ TestCaseName ("{0}" )
403+ @ ParameterizedTest (name = "{0}" )
404+ @ MethodSource ("getNestedColumnFormatSpec" )
409405 public void testIngestAndScanSegmentsAndFilter (String name , boolean auto , NestedCommonFormatColumnFormatSpec spec )
410406 throws Exception
411407 {
@@ -432,9 +428,8 @@ public void testIngestAndScanSegmentsAndFilter(String name, boolean auto, Nested
432428 Assert .assertEquals (1 , ((List ) results .get (0 ).getEvents ()).size ());
433429 }
434430
435- @ Test
436- @ Parameters (method = "getNestedColumnFormatSpec" )
437- @ TestCaseName ("{0}" )
431+ @ ParameterizedTest (name = "{0}" )
432+ @ MethodSource ("getNestedColumnFormatSpec" )
438433 public void testIngestAndScanSegmentsAndRangeFilter (
439434 String name ,
440435 boolean auto ,
@@ -488,17 +483,16 @@ public void testIngestAndScanSegmentsRealtimeSchemaDiscovery() throws Exception
488483 Assert .assertEquals (resultsRealtime .get (0 ).getEvents ().toString (), resultsSegments .get (0 ).getEvents ().toString ());
489484 }
490485
491- @ Test
492- @ Parameters (method = "getNestedColumnFormatSpec" )
493- @ TestCaseName ("{0}" )
486+ @ ParameterizedTest (name = "{0}" )
487+ @ MethodSource ("getNestedColumnFormatSpec" )
494488 public void testIngestAndScanSegmentsRealtimeAutoExplicit (
495489 String name ,
496490 boolean auto ,
497491 NestedCommonFormatColumnFormatSpec spec
498492 ) throws Exception
499493 {
500494 // Test with different column format spec
501- Assume .assumeTrue (auto );
495+ Assumptions .assumeTrue (auto );
502496 DimensionsSpec dimensionsSpec = DimensionsSpec .builder ()
503497 .setDimensions (
504498 List .of (
@@ -612,9 +606,8 @@ public void testIngestAndScanSegmentsRealtimeSchemaDiscoveryTypeGauntlet() throw
612606 Assert .assertEquals (resultsRealtime .get (0 ).getEvents ().toString (), resultsSegments .get (0 ).getEvents ().toString ());
613607 }
614608
615- @ Test
616- @ Parameters (method = "getNestedColumnFormatSpec" )
617- @ TestCaseName ("{0}" )
609+ @ ParameterizedTest (name = "{0}" )
610+ @ MethodSource ("getNestedColumnFormatSpec" )
618611 public void testIngestAndScanSegmentsAndFilterPartialPathArrayIndex (
619612 String name ,
620613 boolean auto ,
@@ -658,9 +651,8 @@ public void testIngestAndScanSegmentsAndFilterPartialPathArrayIndex(
658651 Assert .assertEquals (results .get (0 ).getEvents ().toString (), resultsRealtime .get (0 ).getEvents ().toString ());
659652 }
660653
661- @ Test
662- @ Parameters (method = "getNestedColumnFormatSpec" )
663- @ TestCaseName ("{0}" )
654+ @ ParameterizedTest (name = "{0}" )
655+ @ MethodSource ("getNestedColumnFormatSpec" )
664656 public void testIngestAndScanSegmentsAndFilterPartialPath (
665657 String name ,
666658 boolean auto ,
@@ -701,9 +693,8 @@ public void testIngestAndScanSegmentsAndFilterPartialPath(
701693 Assert .assertEquals (results .get (0 ).getEvents ().toString (), resultsRealtime .get (0 ).getEvents ().toString ());
702694 }
703695
704- @ Test
705- @ Parameters (method = "getNestedColumnFormatSpec" )
706- @ TestCaseName ("{0}" )
696+ @ ParameterizedTest (name = "{0}" )
697+ @ MethodSource ("getNestedColumnFormatSpec" )
707698 public void testIngestAndScanSegmentsNestedColumnNotNullFilter (
708699 String name ,
709700 boolean auto ,
0 commit comments