Issue
I am trying to migrate our application from java-8 to java-11. I am facing issue with pojo junit testing. This is working with java-8 , but with java-11, pojo test class is not running. It looks below dependency is not supporting for java 11.
I have below dependency in dependencies.gradle
testImplementation("pl.pojo:pojo-tester:0.7.6")
Below is my PojoTest class
package com.product.model;
import static pl.pojo.tester.api.assertion.Assertions.assertPojoMethodsFor;
import org.junit.Test;
import pl.pojo.tester.api.assertion.Method;
import com.product.CassOne;
import com.product.CassTwo;
import com.product.CassThree;
public class PojoTests {
@Test
public void testPojos() {
final Class<?>[] classesUnderTest = {
CassOne.class,
ClassTwo.class,
ClassThree.class};
for (Class<?> classUnderTest : classesUnderTest) {
assertPojoMethodsFor(classUnderTest).testing(Method.GETTER, Method.SETTER, Method.TO_STRING).areWellImplemented();
}
}
}
I am facing below Error
java.lang.NullPointerException at the line
assertPojoMethodsFor(classUnderTest).testing(Method.GETTER, Method.SETTER, Method.TO_STRING).areWellImplemented();
Any suggestion how I can resolve this or any other suggestion is most welcome.
Solution
have found alternate depedency which supports for java 11
testImplementation("com.obsidiandynamics.pojotester:pojotester:0.9.0")
Answered By - mike
Answer Checked By - Robin (JavaFixing Admin)