FrankChen021 commented on code in PR #19940:
URL: https://github.com/apache/druid/pull/19940#discussion_r3744187150


##########
processing/src/test/java/org/apache/druid/segment/CloserExtension.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.segment;
+
+import org.apache.druid.java.util.common.io.Closer;
+import org.apache.druid.java.util.common.logger.Logger;
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.TestExecutionExceptionHandler;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * JUnit 5 counterpart to {@link CloserRule}. The rule remains available for 
tests that have not
+ * migrated yet.
+ */
+public class CloserExtension implements BeforeEachCallback, AfterEachCallback, 
TestExecutionExceptionHandler
+{
+  private static final Logger LOG = new Logger(CloserExtension.class);
+
+  private final boolean throwException;
+  private Closer closer;
+
+  public CloserExtension()
+  {
+    this(false);
+  }
+
+  public CloserExtension(final boolean throwException)
+  {
+    this.throwException = throwException;
+  }
+
+  @Override
+  public void beforeEach(final ExtensionContext context)
+  {
+    closer = Closer.create();

Review Comment:
   Fixed in commit 5b968b3f0e: CloserExtension.beforeEach now initializes the 
Closer only when it is null, preserving resources registered during 
test-instance construction. Processing validation passed; the focused 
BitmapIterationTest passed all 14 tests.



##########
processing/src/test/java/org/apache/druid/collections/bitmap/BitmapIterationTest.java:
##########
@@ -19,135 +19,42 @@
 
 package org.apache.druid.collections.bitmap;
 
-import com.google.common.collect.UnmodifiableIterator;
-import com.google.common.collect.testing.CollectionTestSuiteBuilder;
-import com.google.common.collect.testing.SampleElements;
-import com.google.common.collect.testing.TestCollectionGenerator;
-import com.google.common.collect.testing.features.CollectionFeature;
-import com.google.common.collect.testing.features.CollectionSize;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.roaringbitmap.IntIterator;
 
-import java.util.AbstractCollection;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 
-public class BitmapIterationTest extends TestCase
+public class BitmapIterationTest
 {
-  public static Test suite()
+  public static List<BitmapFactory> factories()
   {
-    List<BitmapFactory> factories = Arrays.asList(
-        new BitSetBitmapFactory(),
-        new ConciseBitmapFactory()
-        // Roaring iteration fails because it doesn't throw 
NoSuchElementException on next() call when there are no more
-        // elements. Instead, it either throws NullPointerException or returns 
some unspecified value. If bitmap
-        // iterators are always used correctly in shouldn't be a problem, but 
if next() is occasionally called after
-        // hasNext() returned false and it returns some unspecified value, and 
everything continues to work without
-        // indication that there was a error, it would be a bug that is very 
hard to catch.
-        //
-        // This line should be uncommented when Druid updates RoaringBitmap 
dependency to a version which includes a fix
-        // for https://github.com/RoaringBitmap/RoaringBitmap/issues/129, or 
when RoaringBitmap is included into Druid
-        // as a module and the issue is fixed there.
-
-        //new RoaringBitmapFactory()
-    );
-
-    TestSuite suite = new TestSuite();
-    for (BitmapFactory factory : factories) {
-      suite.addTest(suiteForFactory(factory));
-    }
-    return suite;
+    return List.of(new BitSetBitmapFactory(), new ConciseBitmapFactory());
   }
 
-  private static Test suiteForFactory(BitmapFactory factory)
+  @ParameterizedTest

Review Comment:
   Fixed in commit 5b968b3f0e: restored parameterized Jupiter coverage for 
empty, singleton, multi-element, arbitrary-size, ordering, duplicate, 
exhaustion, and unsupported-mutation cases. BitmapIterationTest passed all 14 
tests, and processing validation passed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to