public void testCloning() {
        LegendItem item1 = new LegendItem("Item");
        LegendItem item2 = null;
        try {
            item2 = (LegendItem) item1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(item1 != item2);
        assertTrue(item1.getClass() == item2.getClass());
        assertTrue(item1.equals(item2));

        // the clone references the same dataset as the original
        assertTrue(item1.getDataset() == item2.getDataset());