### Question:
ClassicOptionHelper extends AbstractOptionHelper { @Override public ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping, String[] axisTitles, OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers) { HashMap<String, Integer> axisNoMap = new HashMap<>(); ChartOptions vAxesOpts = new ChartOptions(); int axNo = 0; for (String axisName : axisNames) { axisNoMap.put(axisName, axNo); ChartOptions axisOpts = new ChartOptions(); axisOpts.put("title", axisTitles[axNo]); if(axisModifiers!= null && axisModifiers[axNo]!= null){ axisModifiers[axNo].modify(axisOpts); } vAxesOpts.put(String.valueOf(axNo++), axisOpts); } parent.put("vAxes", vAxesOpts); ChartOptions seriesOpt = new ChartOptions(); int serNo = 0; for (String seriesMap : seriesMapping) { ChartOptions mapOpt = new ChartOptions(); mapOpt.put("targetAxisIndex", axisNoMap.get(seriesMap)); if(seriesModifiers!= null && seriesModifiers[serNo]!= null){ seriesModifiers[serNo].modify(mapOpt); } seriesOpt.put(String.valueOf(serNo++), mapOpt); } parent.put("series", seriesOpt); return parent; } ClassicOptionHelper(Chart chart); @Override ChartOptions addTitle(ChartOptions parent, IModel<String> titleModel); @Override ChartOptions addTitle(ChartOptions parent, String title); @Override ChartOptions addSubTitle(ChartOptions parent, IModel<String> titleModel); @Override ChartOptions addSubTitle(ChartOptions parent, String subTitle); @Override ChartOptions addDualAxisOptions(ChartOptions parent,
            String[] axisNames, String[] seriesMapping, String[] axisTitles,
            OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers);  }### Answer:
@Test public void testAddDualAxisOptions() { ChartOptions parent = new ChartOptions(); ClassicOptionHelper instance = new ClassicOptionHelper(chart); String[] axisNames = {"Temp", "Humidity"}; String[] seriesMapping = {"Temp", "Temp", "Humidity"}; String[] axisTitles = {"Temperatur", "Feuchtigkeit"}; String expResult = "{\"vAxes\":{\"0\":{\"title\":\"Temperatur\"},\"1\":{\"title\":\"Feuchtigkeit\"}},\"series\":{\"0\":{\"targetAxisIndex\":0},\"1\":{\"targetAxisIndex\":0},\"2\":{\"targetAxisIndex\":1}}}"; ChartOptions result = instance.addDualAxisOptions(parent, axisNames, seriesMapping, axisTitles); assertJsonEquals(expResult, result.toJSON().toString()); }
@Test public void testAddDualAxisOptionsModifier() { ChartOptions parent = new ChartOptions(); ClassicOptionHelper instance = new ClassicOptionHelper(chart); String[] axisNames = {"Temp", "Humidity"}; String[] seriesMapping = {"Temp", "Temp", "Humidity"}; String[] axisTitles = {"Temperatur", "Feuchtigkeit"}; OptionModifier temperatureAxisModifier = new OptionModifier() { @Override public void modify(ChartOptions options) { options.put("format", "percent"); } }; OptionModifier humiditySeriesModifier = new OptionModifier() { @Override public void modify(ChartOptions options) { options.put("lineWidth", 8); } }; String expResult = "{\"vAxes\":{\"0\":{\"format\":\"percent\",\"title\":\"Temperatur\"},\"1\":{\"title\":\"Feuchtigkeit\"}},\"series\":{\"0\":{\"targetAxisIndex\":0},\"1\":{\"targetAxisIndex\":0,\"lineWidth\":8},\"2\":{\"targetAxisIndex\":1}}}"; ChartOptions result = instance.addDualAxisOptions(parent, axisNames, seriesMapping, axisTitles, new OptionModifier[]{temperatureAxisModifier, null}, new OptionModifier[]{null, humiditySeriesModifier, null}); assertJsonEquals(expResult, result.toJSON().toString()); }