Showing posts with label Equals Verifier. Show all posts
Showing posts with label Equals Verifier. Show all posts

Thursday, August 13, 2020

java.lang.AssertionError: UnsupportedOperationException: Cannot define class using reflection

Problem:

If you are using EqualsVerifier for JUnit tesing purpose then there may be a chance you can get this error.

java.lang.AssertionError: UnsupportedOperationException: Cannot define class using reflection

equalsverifier



Solution:

To overcome this error we just have to use the upper version of equalsverifier dependency. Till the version 2.4.7 we will get this error. Hence we can use the equalsverifier 2.4.8 or higher than 2.4.8.

Example:-

<dependency>
    <groupId>nl.jqno.equalsverifier</groupId>
    <artifactId>equalsverifier</artifactId>
    <version>2.4.8</version>
    <scope>test</scope>
</dependency>

Thats it!

Happy Coding.