예제 #1
0
 @Override
 public boolean equals(Object otherObject) {
   if (this == otherObject) {
     return true;
   }
   if (!(otherObject instanceof Range)) {
     return false;
   }
   final Range year = (Range) otherObject;
   return this.getRangeStart().equals(year.getRangeStart())
       && this.getRangeEnd().equals(year.getRangeEnd());
 }
예제 #2
0
 /**
  * Testing that the {@link Range#hashCode} method of the {@link Range} class works correctly
  *
  * @see Range#hashCode()
  * @see Range
  */
 @Test
 public void testHash() {
   Range range1 = Range.of(2001, 2010);
   Range range2 = Range.of(2001, 2010);
   assertThat(range1.hashCode(), is(equalTo(range2.hashCode())));
 }