C3Renderer extends AbstractRendererLibrary { public Displayer lookupDisplayer(DisplayerSettings displayerSettings) { DisplayerType displayerType = displayerSettings.getType(); DisplayerSubType subtype = displayerSettings.getSubtype(); C3AbstractDisplayer displayer; switch (displayerType) { case LINECHART: displayer = getLineChartForSubType(subtype); break; case BARCHART: displayer = createBarChartForSubType(subtype); break; case PIECHART: displayer = getPieChartForSubType(subtype); break; case AREACHART: displayer = getAreaChartForSubType(subtype); break; case BUBBLECHART: displayer = beanManager.lookupBean(C3BubbleChartDisplayer.class).newInstance(); break; case METERCHART: displayer = beanManager.lookupBean(C3MeterChartDisplayer.class).newInstance(); break; case MAP: displayer = createMapChartForSubType(subtype); break; default: return null; } return displayer; }  @PostConstruct void prepare(); @Override String getUUID(); @Override String getName(); @Override List<DisplayerSubType> getSupportedSubtypes(DisplayerType displayerType); Displayer lookupDisplayer(DisplayerSettings displayerSettings); @Override List<DisplayerType> getSupportedTypes(); @Override boolean isDefault(DisplayerType type); static final String UUID; }
@Test public void lookupAreaChartTest() { when(settings.getType()).thenReturn(AREACHART); when(settings.getSubtype()).thenReturn(AREA_STACKED); renderer.lookupDisplayer(settings); verify(c3AreaChartDisplayer).stacked(); }
@Test public void lookupBarChartColumnStacked() { when(settings.getType()).thenReturn(BARCHART); when(settings.getSubtype()).thenReturn(COLUMN_STACKED); renderer.lookupDisplayer(settings); verify(c3BarChartDisplayer).stacked(); }
@Test public void lookuBarChartColumn() { when(settings.getType()).thenReturn(BARCHART); when(settings.getSubtype()).thenReturn(COLUMN); renderer.lookupDisplayer(settings); verify(c3BarChartDisplayer).notRotated(); }
@Test public void lookupBarChartStacked() { when(settings.getType()).thenReturn(BARCHART); when(settings.getSubtype()).thenReturn(BAR_STACKED); renderer.lookupDisplayer(settings); verify(c3BarChartDisplayer).stackedAndRotated(); }
@Test public void lookupBarChartBar() { when(settings.getType()).thenReturn(BARCHART); when(settings.getSubtype()).thenReturn(BAR); renderer.lookupDisplayer(settings); verify(c3BarChartDisplayer).rotated(); }
@Test public void lookupLineChart() { when(settings.getType()).thenReturn(LINECHART); when(settings.getSubtype()).thenReturn(LINE); renderer.lookupDisplayer(settings); verify(c3LineChartDisplayer, times(0)).smooth(); }
@Test public void lookupLineChartSmooth() { when(settings.getType()).thenReturn(LINECHART); when(settings.getSubtype()).thenReturn(SMOOTH); renderer.lookupDisplayer(settings); verify(c3LineChartDisplayer).smooth(); }
@Test public void lookupPieChart() { when(settings.getType()).thenReturn(PIECHART); when(settings.getSubtype()).thenReturn(PIE); renderer.lookupDisplayer(settings); verify(c3PieChartDisplayer, times(0)).donut(); }
@Test public void lookupPieChartDonut() { when(settings.getType()).thenReturn(PIECHART); when(settings.getSubtype()).thenReturn(DONUT); renderer.lookupDisplayer(settings); verify(c3PieChartDisplayer).donut(); }
@Test public void lookupBubbleChart() { when(settings.getType()).thenReturn(BUBBLECHART); renderer.lookupDisplayer(settings); verify(bubbleChartDisplayerBeanDef).newInstance(); }
@Test public void lookupMeterChart() { when(settings.getType()).thenReturn(METERCHART); renderer.lookupDisplayer(settings); verify(meterChartDisplayerBeanDef).newInstance(); }