Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8280275

JUnit5 tests using Assumptions API fail to compile in some cases

XMLWordPrintable

        Tests using the JUnit 5 Assumptions API fails to compile due to missing dependencies. To reproduce, run the following with "gradle test" on the command line:

        -----------------------------------------------------------------------------
        import static org.junit.jupiter.api.Assertions.assertNotNull;
        import static org.junit.jupiter.api.Assumptions.assumeTrue;

        import org.junit.jupiter.api.Test;

        public class JUnit5Test {

            @Test
            void junit5ShouldWork() {
                assumeTrue(this != null);

                assertNotNull(this);
                System.err.println("JUnit 5 test working!");
            }
        }
        -----------------------------------------------------------------------------


        It will fail with the following error:

        > Task :base:compileTestJava
        modules/javafx.base/src/test/java/test/JUnit5Test.java:37: error: cannot access TestAbortedException
                assumeTrue(this != null);
                          ^
          class file for org.opentest4j.TestAbortedException not found

              kcr Kevin Rushforth
              kcr Kevin Rushforth
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: