Merge pull request #264 from dwvisser/evidence-hashcode-contract

Evidence class compliance with Object.hashCode() contract

Former-commit-id: 94898beb75c867b58a5f8a1cd879b7b47ab47cb5
This commit is contained in:
Jeremy Long
2015-06-29 06:12:17 -04:00
3 changed files with 47 additions and 78 deletions

View File

@@ -19,6 +19,7 @@ package org.owasp.dependencycheck.dependency;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
/**
*
@@ -53,6 +54,14 @@ public class EvidenceTest {
assertTrue(instance.equals(that8));
}
@Test
public void testHashcodeContract() throws Exception {
final Evidence titleCase = new Evidence("Manifest", "Implementation-Title", "Spring Framework", Confidence.HIGH);
final Evidence lowerCase = new Evidence("manifest", "implementation-title", "spring framework", Confidence.HIGH);
assertThat(titleCase, is(equalTo(lowerCase)));
assertThat(titleCase.hashCode(), is(equalTo(lowerCase.hashCode())));
}
/**
* Test of compareTo method, of class Evidence.
*/