Hi devs, I've just browsed the pull request and it looks very good. We can take advantage of the JUnit5 features by this contribution. I'll take another look this week and merge it to the main development branch afterward.
Thanks, Woonsan ---------- Forwarded message --------- From: mureinik <g...@git.apache.org> Date: Thu, Oct 4, 2018 at 8:41 AM Subject: [GitHub] commons-scxml pull request #3: Upgrade to JUnit jupiter To: <iss...@commons.apache.org> GitHub user mureinik opened a pull request: https://github.com/apache/commons-scxml/pull/3 Upgrade to JUnit jupiter This PR migrates the project to the modern JUnit Jupiter 5.3.1 testing framework. Since JUnit Jupiter is not backwards compatible to JUnit 4.x, or even JUnit Vintage 5.x, the patch is a tad large, although most of the changes are just cosmetic. 1. Maven changes: 1. `org.junit.jupiter:junit-jupiter-api` was added to provide the new APIs used. 1. `org.junit.jupiter:junit-jupiter-engine` was added as a testing engine. Its presence allows `maven-surefire-plugin` to use the Jupiter provider in order to execute tests. 1. `junit:junit` was removed, as it's no longer in use. 1. The parent module, `org.apache.commons:commons-parent` was upgraded to the latest version, `47`, in order to consume `org.apache.maven.plugins:maven-surefire-plugin:2.22.0` that natively supports Jupiter tests. 1. Annotations: 1. `org.junit.jupiter.api.Test` was used as a drop in replacement for `org.juit.Test` without arguments. See 3.b for handling of the `@Test` annotation with an `expected` argument. 1. `org.junit.jupiter.api.BeforeEach` was used as an drop in replacement for `org.junit.Before`. 1. `org.junit.jupiter.api.AfterEach` was used as a drop in replacement for `org.junit.After`. 1. `org.junit.jupiter.api.BeforeAll` was used as a drop in replacement for `org.junit.BeforeClass`. 1. `org.junit.jupiter.api.AfterAll` was used as a drop in replacement for `org.junit.AfterClass`. 3. Assertions: 1. `org.junit.jupiter.api.Assertions`' methods were used as a drop in replacements for `org.junit.Assert`'s methods with the same name in the simple case of an assertion without a message. In the case of an assertion with a message, `org.junit.jupiter.api.Assertions`' methods were used, but the argument order was changed - `Assert`'s methods take the message as the first argument, while `Assertions`' methods take the message as the last argument. 1. `org.junit.jupiter.api.Assertions#assertThrows` was used to assert a specific exception was thrown instead of an `org.junit.Test` annotation with an `expected` argument. This technique has a side bonus of making the tests slightly stricter, as now they assert the exception was thrown from a specific line and prevent false posivites where the test's "set-up" code accidentally threw that exception. The `throws` clauses of these methods were cleaned up from exceptions that can no longer be thrown in order to avoid compilation warnings. 4. Miscelanious 1. The redundant `main` methods in the test classes of the `org.apache.commons.scxml2.env.javascript` package were removed, and the Javadoc was updated accordingly. You can merge this pull request into a Git repository by running: $ git pull https://github.com/mureinik/commons-scxml junit-jupiter Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-scxml/pull/3.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3 ---- commit 3d133ce5490a26252622c14d34460501770506e0 Author: Allon Mureinik <allon@...> Date: 2018-10-04T09:55:34Z Remove unused main methods Remove unused main methods of in the org.apache.commons.scxml2.env.javascript package. These tests do not need tham, as they are run via maven-surefire-plugin which picks up the annotated tests. commit 73462b0538755f838ea47fd6c83e31b393e6762d Author: Allon Mureinik <allon@...> Date: 2018-10-04T09:56:36Z javadoc fix Fix org.apache.commons.scxml2.env.javascript tests' javadocs - the test methods are clearly annotaed with JUnit 4 annotations, and therefore these are not a JUnit 3 tests. commit 521518be32d3b1ab1f28e3509347702c1d7a3c8d Author: Allon Mureinik <allon@...> Date: 2018-10-04T11:04:03Z org.apache.commons:commons-parent dependency Upgraded to the latest available org.apache.commons:commons-parent in order to consume the latest maven-surefire-plugin required for the JUnit Jupiter upgarde. commit 8444b30a11e87e8b8e990d9c145ea4b1e617a0d0 Author: Allon Mureinik <allon@...> Date: 2018-10-04T10:59:39Z Upgrade to JUnit Jupiter This PR migrates the project to the modern JUnit Jupiter 5.3.1 testing framework. Since JUnit Jupiter is not backwards compatible to JUnit 4.x, or even JUnit Vintage 5.x, the patch is a tad large, although most of the changes are just cosmetic. 1. Maven changes: a. org.junit.jupiter:junit-jupiter-api was added to provide the new APIs used. b. org.junit.jupiter:junit-jupiter-engine was added as a testing engine. Its presence allows maven-surefire-plugin to use the Jupiter provider in order to execute tests. c. junit:junit was removed, as it's no longer in suse. 2. Annotations: a. org.junit.jupiter.api.Test was used as a drop in replacement for org.juit.Test without arguments. See 3.b for handling of the @Test annotation with an "expected" argument. b. org.junit.jupiter.api.BeforeEach was used as an drop in replacement for org.junit.Before. c. org.junit.jupiter.api.AfterEach was used as a drop in replacement for org.junit.After. d. org.junit.jupiter.api.BeforeAll was used as a drop in replacement for org.junit.BeforeClass. e. org.junit.jupiter.api.AfterAll was used as a drop in replacement for org.junit.AfterClass. 3. Assertions: a. org.junit.jupiter.api.Assertions' methods were used as a drop in replacements for org.junit.Assert's methods with the same name in the simple case of an assertion without a message. In the case of an assertion with a message, org.junit.jupiter.api.Assertions' methods were used, but the argument order was changed - Assert's methods take the message as the first argument, while Assertions' methods take the message as the last argument. b. org.junit.jupiter.api.Assertions#assertThrows was used to assert a specific exception was throws instead of an org.junit.Test annotation with an "expected" argument. This technique has a side bonus of making the tests slightly stricter, as now they assert the exception was thrown from a specific line and prevent false posivites where the test's "set-up" code accidentally threw that exception. The throws clauses of these methods were cleaned up from exceptions that can no longer be thrown in order to avoid compilation warnings. ---- --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org