mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-13 05:35:36 +01:00
Made hashCode() implement satisfy the Object.hashCode() contract, i.e., a.equals(b) implies a.hashCode() == b.hashCode()
Former-commit-id: 9f347a57b740b572d2d6a9a9e523de44e384773e
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user