lidavidm commented on code in PR #42029:
URL: https://github.com/apache/arrow/pull/42029#discussion_r1635828456
##########
java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestParallelSearcher.java:
##########
@@ -48,45 +46,39 @@ private enum ComparatorType {
private static final int VECTOR_LENGTH = 10000;
- private final int threadCount;
-
private BufferAllocator allocator;
private ExecutorService threadPool;
- private final ComparatorType comparatorType;
-
- public TestParallelSearcher(ComparatorType comparatorType, int threadCount) {
- this.comparatorType = comparatorType;
- this.threadCount = threadCount;
- }
-
- @Parameterized.Parameters(name = "comparator type = {0}, thread count = {1}")
- public static Collection<Object[]> getComparatorName() {
- List<Object[]> params = new ArrayList<>();
+ public static Stream<Arguments> getComparatorName() {
+ List<Arguments> params = new ArrayList<>();
int[] threadCounts = {1, 2, 5, 10, 20, 50};
for (ComparatorType type : ComparatorType.values()) {
for (int count : threadCounts) {
- params.add(new Object[] {type, count});
+ params.add(Arguments.of(type, count));
}
}
- return params;
+ return params.stream();
}
- @Before
+ @BeforeEach
public void prepare() {
allocator = new RootAllocator(1024 * 1024);
- threadPool = Executors.newFixedThreadPool(threadCount);
}
- @After
+ @AfterEach
public void shutdown() {
allocator.close();
- threadPool.shutdown();
+ if (threadPool != null) {
+ threadPool.shutdown();
+ }
}
- @Test
- public void testParallelIntSearch() throws ExecutionException,
InterruptedException {
+ @ParameterizedTest
+ @MethodSource("getComparatorName")
+ public void testParallelIntSearch(ComparatorType comparatorType, int
threadCount)
+ throws ExecutionException, InterruptedException {
+ threadPool = Executors.newFixedThreadPool(threadCount);
Review Comment:
It appears https://github.com/junit-team/junit5/issues/878 is the feature
request.
--
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]