Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pojo testing with java 11

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.

like image 365
mike Avatar asked Jan 28 '26 07:01

mike


1 Answers

have found alternate depedency which supports for java 11

testImplementation("com.obsidiandynamics.pojotester:pojotester:0.9.0")

like image 182
mike Avatar answered Jan 30 '26 12:01

mike



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!