Exemplo n.º 1
0
 /** Two objects that are equal are required to return the same hashCode. */
 public void testHashcode() {
   ImageTitle t1 = new ImageTitle(JFreeChart.INFO.getLogo());
   ImageTitle t2 = new ImageTitle(JFreeChart.INFO.getLogo());
   assertTrue(t1.equals(t2));
   int h1 = t1.hashCode();
   int h2 = t2.hashCode();
   assertEquals(h1, h2);
 }
Exemplo n.º 2
0
 /** Confirm that cloning works. */
 public void testCloning() {
   ImageTitle t1 = new ImageTitle(JFreeChart.INFO.getLogo());
   ImageTitle t2 = null;
   try {
     t2 = (ImageTitle) t1.clone();
   } catch (CloneNotSupportedException e) {
     System.err.println("ImageTitleTests.testCloning: failed to clone.");
   }
   assertTrue(t1 != t2);
   assertTrue(t1.getClass() == t2.getClass());
   assertTrue(t1.equals(t2));
 }
Exemplo n.º 3
0
 /** Check that the equals() method distinguishes all fields. */
 public void testEquals() {
   ImageTitle t1 = new ImageTitle(JFreeChart.INFO.getLogo());
   ImageTitle t2 = new ImageTitle(JFreeChart.INFO.getLogo());
   assertEquals(t1, t2);
 }
Exemplo n.º 4
0
 /** Check the width and height. */
 public void testWidthAndHeight() {
   ImageTitle t1 = new ImageTitle(JFreeChart.INFO.getLogo());
   assertEquals(100, t1.getWidth(), EPSILON);
   assertEquals(100, t1.getHeight(), EPSILON);
 }