没有任何数据可供显示
| 开源项目社区 | 当前位置 : |
|
| www.trustie.net/open_source_projects | 主页 > 开源项目社区 > equalsverifier |
|
equalsverifier
|
| 2 | 0 | 251 |
| 贡献者 | 讨论 | 代码提交 |
EqualsVerifierEqualsVerifier can be used in Java unit tests to verify whether the contract for the equals and hashCode methods in a class is met. The contracts are described in the Javadoc comments for the java.lang.Object class.
Quick startMaven users: click here. Make sure the following jars are on the classpath: objenesis-1.1.jar cglib-nodep-2.2.jar The EqualsVerifier jar. See Featured Downloads to download. Use, as follows, in your unit test: @Test
public void equalsContract() {
EqualsVerifier.forClass(My.class).verify();
}Or, with some warnings suppressed: @Test
public void equalsContract() {
EqualsVerifier.forClass(My.class)
.suppress(Warning.NONFINAL_FIELDS, Warning.NULL_FIELDS)
.verify();
}When EqualsVerifier detects a problem, it will explain what it thinks is wrong. In some cases (mostly when it needs more information), it will say what to do to fix the problem.
The long storySee the Documentation.
What's newSee the Changelog.
标签:
