public void testEquals() {
StandardPieItemLabelGenerator g1 = new StandardPieItemLabelGenerator();
StandardPieItemLabelGenerator g2 = new StandardPieItemLabelGenerator();
assertTrue(g1.equals(g2));
assertTrue(g2.equals(g1));
g1 = new StandardPieItemLabelGenerator(
"{0}", new DecimalFormat("#,##0.00"),
NumberFormat.getPercentInstance()
);
assertFalse(g1.equals(g2));
g2 = new StandardPieItemLabelGenerator(
"{0}", new DecimalFormat("#,##0.00"),
NumberFormat.getPercentInstance()
);
assertTrue(g1.equals(g2));
g1 = new StandardPieItemLabelGenerator(
"{0} {1}", new DecimalFormat("#,##0.00"),
NumberFormat.getPercentInstance()
);
assertFalse(g1.equals(g2));
g2 = new StandardPieItemLabelGenerator(
"{0} {1}", new DecimalFormat("#,##0.00"),
NumberFormat.getPercentInstance()
);
assertTrue(g1.equals(g2));
g1 = new StandardPieItemLabelGenerator(
"{0} {1}", new DecimalFormat("#,##0"),
NumberFormat.getPercentInstance()
);
assertFalse(g1.equals(g2));
g2 = new StandardPieItemLabelGenerator(
"{0} {1}", new DecimalFormat("#,##0"),
NumberFormat.getPercentInstance()
);
assertTrue(g1.equals(g2));
g1 = new StandardPieItemLabelGenerator(
"{0} {1}", new DecimalFormat("#,##0"), new DecimalFormat("0.000%")
);
assertFalse(g1.equals(g2));
g2 = new StandardPieItemLabelGenerator(
"{0} {1}", new DecimalFormat("#,##0"), new DecimalFormat("0.000%")
);
assertTrue(g1.equals(g2));
}
Test that the equals() method distinguishes all fields. |