/**
* Confirm that cloning works.
*/
public void testCloning1() {
AbstractCategoryItemRenderer r1 = new BarRenderer();
r1.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
AbstractCategoryItemRenderer r2 = null;
try {
r2 = (BarRenderer) r1.clone();
}
catch (CloneNotSupportedException e) {
System.err.println("Failed to clone.");
}
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
r1 = new BarRenderer();
r1.setSeriesItemLabelGenerator(
0, new StandardCategoryItemLabelGenerator()
);
r2 = null;
try {
r2 = (BarRenderer) r1.clone();
}
catch (CloneNotSupportedException e) {
System.err.println("Failed to clone.");
}
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
r1 = new BarRenderer();
r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
r2 = null;
try {
r2 = (BarRenderer) r1.clone();
}
catch (CloneNotSupportedException e) {
System.err.println("Failed to clone.");
}
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
}