Issue #1293: One more unit test for EqualsHashCodeCheck
This commit is contained in:
parent
b405880b6e
commit
95eb2122d5
1
pom.xml
1
pom.xml
|
|
@ -1100,7 +1100,6 @@
|
|||
<regex><pattern>.*.checks.coding.DeclarationOrderCheck</pattern><branchRate>82</branchRate><lineRate>93</lineRate></regex>
|
||||
<regex><pattern>.*.checks.coding.DefaultComesLastCheck</pattern><branchRate>87</branchRate><lineRate>100</lineRate></regex>
|
||||
<regex><pattern>.*.checks.coding.EqualsAvoidNullCheck</pattern><branchRate>79</branchRate><lineRate>100</lineRate></regex>
|
||||
<regex><pattern>.*.checks.coding.EqualsHashCodeCheck</pattern><branchRate>75</branchRate><lineRate>100</lineRate></regex>
|
||||
<regex><pattern>.*.checks.coding.ExplicitInitializationCheck</pattern><branchRate>91</branchRate><lineRate>97</lineRate></regex>
|
||||
<regex><pattern>.*.checks.coding.FallThroughCheck</pattern><branchRate>90</branchRate><lineRate>97</lineRate></regex>
|
||||
<regex><pattern>.*.checks.coding.FinalLocalVariableCheck</pattern><branchRate>82</branchRate><lineRate>100</lineRate></regex>
|
||||
|
|
|
|||
|
|
@ -41,6 +41,15 @@ public class EqualsHashCodeCheckTest
|
|||
verify(checkConfig, getPath("InputSemantic.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBooleanMethods() throws Exception {
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(EqualsHashCodeCheck.class);
|
||||
final String[] expected = {
|
||||
};
|
||||
verify(checkConfig, getPath("coding/InputEqualsHashCodeCheck.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTokensNotNull() {
|
||||
EqualsHashCodeCheck check = new EqualsHashCodeCheck();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.puppycrawl.tools.checkstyle.coding;
|
||||
|
||||
public class InputEqualsHashCodeCheck {
|
||||
public boolean notEquals() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean equals() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(Object o1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean equals(Object o1, Object o2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected int notHashCode() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int hashCode(Object o1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
private int hashCode(Object o1, Object o2) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue