pradeesh-kumar opened a new pull request #295:
URL: https://github.com/apache/commons-collections/pull/295


   **Jira:** https://issues.apache.org/jira/browse/COLLECTIONS-807
   
   **Description:** COLLECTIONS-807 is a subtask of the main task 
[COLLECTIONS-777-Fully migrate to JUnit 
5](https://issues.apache.org/jira/browse/COLLECTIONS-777)
   
   **Subtask COLLECTIONS-807 description:**  Upgrade org.junit.Test to 
org.junit.jupiter.api.Test
   
   **Major Changes**
   1. pom.xml
   Added the dependency _junit-jupiter-params_ in order to fix the 
parameterized test case issues after upgrading the Test annotation in the 
classes AbstractPropertiesFactoryTest.java, SortedPropertiesFactoryTest.java, 
PropertiesFactoryTest.java
   ```
   <dependency>
     <groupId>org.junit.jupiter</groupId>
     <artifactId>junit-jupiter-params</artifactId>
     <version>${commons.junit.version}</version>
     <scope>test</scope>
   </dependency>
   ```
   
   2. Annotated setup() methods with @BeforeEach annotation
   Example:
   ```
   @Override
   public void setUp() {
       testList = new ArrayList<>();
       testList.addAll(Arrays.asList(testArray));
   }
   ```
   Rewritten to
   ```
   @BeforeEach
   public void setUp() {
       testList = new ArrayList<>();
       testList.addAll(Arrays.asList(testArray));
   }
   ```
   
   3. Removed the String parameter testName from all the Junit test classes.
   Reason: Junit below 5 was supporting the constructor to have a String 
parameter, which will be injected with the current Display name of the test 
case being run. This is no more supported in JUnit 5. Since JUnit 5, a 
constructor with arguments is considered to as a Parameterized test case. To 
remove the test execution issue after upgrading the annotation, removed the 
parameter from constructor, instead pass the current class name (which is equal 
to the test case name) to the super classes.
   
   ```
   public BooleanComparatorTest(String testName) {
       super(testName);
   }
   ```
   
   Rewritten as
   
   ```
   public BooleanComparatorTest() {
       super(BooleanComparatorTest.class.getSimpleName());
   }
   ```


-- 
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]


Reply via email to