mureinik opened a new pull request #68: URL: https://github.com/apache/commons-bcel/pull/68
This PR migrates the project to the modern JUnit Jupiter in order to make it easier to write tests for it and lower the entry bar for new contributors. While JUnit 4 and JUnit Jupiter are similar in many ways, they are not API compatible, so some changes had to be made: 1. Dependencies 1. The dependency on `junit.junit:4.13` was replaced by a dependency on `org.junit.jupiter:junit-jupiter` 1. Annotations 1. `org.junit.jupiter.api.Test` was used as a drop-in replacement for `org.junit.Test` in the simple case the annotation had no arguments. 1. `org.junit.jupiter.api.Test` was added to existing JUnit 3 style test methods (i.e., `public`, `void` methods with no arguments and a name begining in "test'). 1. `org.junit.jupiter.api.BeforeEach` was used as a drop-in replacement for `org.junit.Before`. 1. `org.junit.jupiter.api.BeforeEach` was added to existing JUnit 3 style setUp methods (i.e., methods with the signature `public void setUp()`). 1. `org.junit.jupiter.api.Disabled` was used as a drop-in replacement for `org.junit.Ignore`. 1. Classes annotated with `@RunWith(Parameterized.class)` were rewritten so their test use `org.junit.jupiter.params.ParameterizedTest` 1. Class structure 1. `junit.framework.TestCase` was removed as a super class from the classes that extended it. 1. Assertions 1. `org.junit.jupiter.api.Assertions`' methods were used as drop-in replacements for methods of the same name from `org.junit.Assert` in the case the method didn't use the optional message argument. 1. `org.junit.jupiter.api.Assertions`' methods were used as replacements for methods of the same name from `org.junit.Assert` in the case the method did use the optional message argument. In this case, the message argument that was the first argument in the `Assert`'s method was moved to be the last argument in the `Assertions`' method arguments. 1. Usages of `org.junit.Assert`'s methods via the wrappers in `junit.Framework.TestCase` were replaced with static imports of the corresponding method from `org.junit.jupiter.api.Assertiosn`, as detailed in the two previous points. 1. `org.junit.Test` annotations with an `expected` argument were replaced by `org.junit.jupiter.api.Assertions#assertThrows` calls. As a side bonus, this change also makes the test more accurate by narrowing the scope that's expected to throw the exception and preventing false positives from situations where the wrong statement throws the expected exception. 1. Assumptions 1. `org.junit.jupiter.api.Assumptions`' methods were used as drop-in replacements for methods of the same name from `org.junit.Assume`. 1. Miscellaneous 1. In `org.apache.bcel.HandleTestCase1, the dependency on `junit.framework.AssertionFailedError` was removed, and instead its JDK parent, `java.lang.AssertionError`, was used. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org