0

I think I may be the only one experiencing this issue.

I, today, updated my eclipse install to version 2020-03 (4.15.0). I am also attempting to write a very simple JUnit 5 test for a new method I'm working on.

When I run my test, right now just a basic stub, I get the following error:


    java.lang.SecurityException: class "org.junit.platform.commons.PreconditionViolationException"'s signer information does not match signer information of other classes in the same package
        at java.base/java.lang.ClassLoader.checkCerts(ClassLoader.java:1150)
        at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:905)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1014)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:821)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:719)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:642)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:600)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createUnfilteredTest(JUnit5TestLoader.java:75)
        at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createTest(JUnit5TestLoader.java:66)
        at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.loadTests(JUnit5TestLoader.java:53)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:526)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)

I also see the following dialog

enter image description here

My run Configuration is: enter image description here

I've tried all major junit-jupiter (aggregator) releases back to 5.5.0 all resulting in the same issue.

I've tried this solution. However, that question deals with a class not found issue. I also tried that same solution using using junit-platform-commons version 1.6.1. no change.

However, I can run maven configuration with -Dtest=DeaFileListTest test the the tests run.

My test case is simple, I instantiate an object that has the method I want to test and then my test.


    import static org.hamcrest.MatcherAssert.assertThat;
    import static org.hamcrest.Matchers.empty;
    import static org.hamcrest.Matchers.not;

    import java.io.IOException;
    import java.util.List;

    import javax.ws.rs.core.Response;

    import org.junit.jupiter.api.AfterAll;
    import org.junit.jupiter.api.BeforeAll;
    import org.junit.jupiter.api.Test;

    import com.mfgweb.FileRepo;

    class DeaFileListTest {

        private static FileRepo filerepo;
        private static Response response;

        @BeforeAll
        static void setUpBeforeClass() throws Exception {

            filerepo = new FileRepo();
            response = filerepo.getDeaFiles();
        }

        @AfterAll
        static void tearDownAfterClass() throws Exception {

            response = null;
            filerepo = null;
        }

        @Test
        public void deaFileListIsNotEmptyTest() throws IOException {

            @SuppressWarnings ( "unchecked" )
            List< String > files = ( List< String > )response.getEntity();

            assertThat( files, not( empty() ) );
        }
    }

So I am curious why I'm receiving the Security Exception when I run the test in eclipse, yet Maven seems to execute them fine.

Paul Stoner
  • 1,359
  • 21
  • 44
  • 1
    This *might* help: https://stackoverflow.com/a/57476494/3135317 (although it sounds like you've been trying something similar). Be sure to not only a) rebuild (after modifying your pom.xml), but physically DELETE all the binaries in your project, then try rebuilding. – FoggyDay Mar 25 '20 at 19:53
  • @FoggyDay, My apologies. I don't know what I did, but I thought your suggestion worked. Though now I think I ran it as a maven test. Adding in the dependency management and thoroughly clean my target folder made no difference. I'm still receiving the error described above. Thank you for your kind response – Paul Stoner Mar 26 '20 at 14:57

0 Answers0