@Test
public void testAddListener() {

    Plot plot = new MockPlot("MockPlot");
    ArrayList<PlotListener> listeners = plot.getListeners();
    assertEquals(0, listeners.size());
    MockPlotListener pl1 = new MockPlotListener();
    MockPlotListener pl2 = new MockPlotListener();
    plot.addListener(pl1);
    assertEquals(1, listeners.size());
    // should return false on a double entry attempt
    assertFalse(plot.addListener(pl1));
    // make sure the listener wasnt added anyway:
    assertEquals(1, listeners.size());
    plot.addListener(pl2);
    assertEquals(2, listeners.size());
}