You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/04/01 05:24:31 UTC

[GitHub] [accumulo] ctubbsii commented on a change in pull request #2584: Migrate iterator-test-harness module JUnit5

ctubbsii commented on a change in pull request #2584:
URL: https://github.com/apache/accumulo/pull/2584#discussion_r840242856



##########
File path: iterator-test-harness/src/main/java/org/apache/accumulo/iteratortest/junit5/BaseJUnit5IteratorTest.java
##########
@@ -0,0 +1,110 @@
+/*
+ * 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.accumulo.iteratortest.junit5;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.accumulo.iteratortest.IteratorTestInput;
+import org.apache.accumulo.iteratortest.IteratorTestOutput;
+import org.apache.accumulo.iteratortest.IteratorTestReport;
+import org.apache.accumulo.iteratortest.IteratorTestRunner;
+import org.apache.accumulo.iteratortest.testcases.IteratorTestCase;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A base JUnit5 test class for users to leverage with the JUnit ParameterizedTest.
+ * <p>
+ * Users should extend this class and override the parameters() method to provide a list of
+ * Arguments, each of which serve as the parameters for an iterator test case.
+ *
+ * <pre>
+ * public static List&lt;Arguments&gt; parameters() {
+ *   IteratorTestInput input = createIteratorInput();
+ *   IteratorTestOutput expectedOutput = createIteratorOutput();
+ *   List&lt;IteratorTestCase&gt; testCases = createTestCases();
+ *   return BaseJUnit5IteratorTest.createParameters(input, expectedOutput, testCases);
+ * }
+ * </pre>
+ */
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public abstract class BaseJUnit5IteratorTest {

Review comment:
       I agree the List version is better... I don't think we want to keep the 2D array. I'm pretty sure it was only that way because it had to be. I think it should be fine to document the change in parameter types in the release notes. The file is going to be renamed either way, and should be documented.
   
   I'm just thinking that maybe we can have our own types so it's not exposing the JUnit5 type, `Arguments`, but a type of our own that is analogous and we can easily translate into the JUnit5 type (or some other type if we move off of JUnit5 at some future point). The `Object[][]` type, while terrible, did have the advantage of not being strictly tied to JUnit4 or anything else... but perhaps we can do better?




-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org