EqualsVerifier can be used in Java unit tests to verify whether the contract for the equals and hashCode methods is met.
EqualsVerifier can be used in Java unit tests to verify whether the contract for the equals and hashCode methods in a class is met. The Maven coordinates are:
nl.jqno.equalsverifier equalsverifier 3.5.5 test
Please see the project's website.
To build EqualsVerifier, you need Maven. Just call
mvnfrom the command-line, without any parameters, and you're done. Alternatively, you can use any IDE with Maven support.
mvn(without any parameters), which will also run the tests and all the other static analysis. Or run
mvn spotless:applyto only run the formatter.
src/testfolder contains, apart from the regular
javafolder, some version-specific
javaXXfolders that target specific JDKs. For instance, the
src/test/java16folder contains unit tests that test things related to records. A Maven profile automatically picks up these folders if the JDK that runs the tests has at least that version.
nl.jqno.equalsverifier.internal.architecture.TestPresenceTestchecks that the tests are indeed picked up when the JDK version matches.
lib/folder contains a local Maven repository containing a signed jar, used to test potential ClassLoader issues
mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file \ -Dfile=<path-to-file> -DgroupId=<myGroup> \ -DartifactId=<myArtifactId> -Dversion=<myVersion> \ -Dpackaging=<myPackaging> -DcreateChecksum=true \ -DlocalRepositoryPath=libThe signed jar itself can be found in this repo.
Copyright 2009-2020 Jan Ouwens