LegendEntry extends JPanel implements MouseListener, AbstractLegendEntry { public void setLineSettings(LineSettings settings) { lineSettings = settings; updateLinePlotFromSettings(); } LegendEntry(Color theBackgroundColor, Color theForegroundColor, Font font, AbbreviatingPlotLabelingAlgorithm thisPlotLabelingAlgorithm); void setBaseDisplayName(String theBaseDisplayName); @Override void mouseClicked(MouseEvent e); @Override void mouseEntered(MouseEvent e); @Override void mouseExited(MouseEvent e); @Override void mousePressed(MouseEvent e); @Override void mouseReleased(MouseEvent e); String getToolTipText(); String getBaseDisplayNameLabel(); String getFullBaseDisplayName(); String getComputedBaseDisplayName(); String getTruncatedBaseDisplayName(); void setPlotLabelingAlgorithm(AbbreviatingPlotLabelingAlgorithm plotLabelingAlgorithm); AbbreviatingPlotLabelingAlgorithm getPlotLabelingAlgorithm(); int getLabelWidth(); @Override void setForeground(Color fg); LegendEntryPopupMenuFactory getPopup(); void setPopup(LegendEntryPopupMenuFactory popup); void setLineSettings(LineSettings settings); LineSettings getLineSettings(); boolean hasRegressionLine(); void setHasRegressionLine(boolean regressionLine); int getNumberRegressionPoints(); void setNumberRegressionPoints(int numberRegressionPoints); LinearXYPlotLine getRegressionLine(); void setRegressionLine(LinearXYPlotLine regressionLine); String getDataSetName(); void setDataSetName(String dataSetName); @Override void attachPlotLine(AbstractPlotLine plotLine); @Override String getDisplayedName();  }
@Test public void testUpdatesIcon() { JWindow w = new JWindow(); w.getContentPane().add(legendEntry); w.setVisible(true); w.pack(); Mockito.when(mockPlotLine.getPointIcon()).thenReturn(mockIcon); int i = 0; for (boolean b : new boolean[]{false, true}) { Mockito.verify(mockPlotLine, Mockito.times(i)).setPointIcon(Mockito.<Icon>any()); Mockito.when(mockSettings.getUseCharacter()).thenReturn(b); Mockito.when(mockSettings.getMarker()).thenReturn(0); Mockito.when(mockSettings.getCharacter()).thenReturn("X"); legendEntry.setLineSettings(mockSettings); Mockito.verify(mockPlotLine, Mockito.times(++i)).setPointIcon(Mockito.<Icon>any()); } w.setVisible(false); w.dispose(); }