Skip to content
Advertisement

How to resolve arquillian static variable = null

Since i upgraded to WildFly 23 I have not been able to get shrinkwrap/arquillian to resolve classes correctly.

Here is the createDeployment function

    public static Archive<?> createBasicShrinkWrappedDeployment()
    {
        File[] mavenImports = Maven.resolver()
                .loadPomFromFile("pom.xml")
                .importRuntimeDependencies()
                .resolve()
                .withTransitivity()
                .asFile();

        return ShrinkWrap.create(WebArchive.class, "<project>-tests.war")
                .addAsLibraries(mavenImports)
                .addPackages(true, "org.<company>.crs")
                .addAsResource("jbossas-managed/test-persistence.xml", "META-INF/persistence.xml")
                .addAsResource("jbossas-managed/test-orm.xml", "META-INF/orm.xml")
                .addAsResource("templates/email/template1.vm")
                .addAsResource("templates/email/template2.vm")
                .addAsResource("templates/email/template3.vm")
                .addAsResource("templates/email/template4.vm")
                .addAsResource("templates/pdf/template5.vm")


                .addAsWebInfResource("beans.xml", "beans.xml");
    }

My issue is that for testing we have some test data that exists at: org.<company>.crs.utils, it is a bunch of static data that we use for our functional tests to compare the expected database data to the static data in the application. Here is an example:

package org.<company>.crs.utils;
public class UserInfo{
    public static class Id
    {
        public static UUID Steve = UUID.fromString("...");
        public static UUID TestPerson = UUID.fromString("...");
        public static UUID Anonymous = UUID.fromString("...");
    }
    ... <more test classes like Id>
}

Now, when we run the tests we may run something like:

Assert.assertEquals(permission.getIdentityId(), UserInfo.Id.Steve);

However, UserInfo.Id.Steve is null, i am assuming this is a shrinkwrap or arquillian issue since that data is statically defined and cannot be null.

This had worked until we updated the application server from WF8 to WF23 (and made a bunch of other changes along the way). Wondering if anyone knows what caused this, or how to resolve it?

Advertisement

Answer

Further developments in the troubleshooting process have concluded that this is an issue with (i think) my IDE and not the testing framework. See the above comments for a link to the new question about the IDE issue.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement