예제 #1
0
 /** Two objects that are equal are required to return the same hashCode. */
 public void testHashCode() {
   Stroke stroke = new BasicStroke(2.0f);
   XYPolygonAnnotation a1 =
       new XYPolygonAnnotation(
           new double[] {1.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke, Color.red, Color.blue);
   XYPolygonAnnotation a2 =
       new XYPolygonAnnotation(
           new double[] {1.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke, Color.red, Color.blue);
   assertTrue(a1.equals(a2));
   int h1 = a1.hashCode();
   int h2 = a2.hashCode();
   assertEquals(h1, h2);
 }