### Question:
FlotChartGenerator { public FlotChart generateFlotChart(ChartCode chartCode, AnalysisForm analysisForm) { Chart<Object, Number> chart = chartGenerator.generateChart(chartCode, analysisForm); FlotChart flotChart = chartConverter.convert(chart); return flotChart; }  FlotChart generateFlotChart(ChartCode chartCode, AnalysisForm analysisForm); boolean canGenerateChart(ChartCode chartCode, AnalysisForm analysisForm); @Autowired void setChartGenerator(ChartGenerator chartGenerator); @Autowired void setChartConverter(ChartConverter chartConverter);  }### Answer:
@Test public void generateFlotChart_TRUE() { @SuppressWarnings("unchecked") Chart<Object, Number> chart = mock(Chart.class); when(chartGenerator.generateChart(chartCode, analysisForm)).thenReturn(chart); FlotChart flotChart = mock(FlotChart.class); when(chartConverter.convert(chart)).thenReturn(flotChart); FlotChart generatedFlotChart = flotChartGenerator.generateFlotChart(chartCode, analysisForm); assertTrue(flotChart == generatedFlotChart); verify(chartGenerator).generateChart(chartCode, analysisForm); verify(chartConverter).convert(chart); verifyNoMoreInteractions(chartGenerator, chartConverter); }