@Test public void simpleLoadChart() throws ComponentLookupException { List<MeasurementsChartConfiguration> settings = this.mocker.getComponentUnderTest().loadConfigurationsForMeasurementType("tested"); Assert.assertEquals("tested", settings.get(0).getMeasurementType()); Assert.assertEquals(12, settings.get(0).getLowerAgeLimit()); Assert.assertEquals(36, settings.get(0).getUpperAgeLimit()); Assert.assertEquals(3, settings.get(0).getAgeTickStep()); Assert.assertEquals(6, settings.get(0).getAgeLabelStep()); Assert.assertEquals(12.2, settings.get(0).getLowerValueLimit(), 1.0E-2); Assert.assertEquals(22.2, settings.get(0).getUpperValueLimit(), 1.0E-2); Assert.assertEquals(0.5, settings.get(0).getValueTickStep(), 1.0E-2); Assert.assertEquals(2.0, settings.get(0).getValueLabelStep(), 1.0E-2); Assert.assertEquals("Weight for age, 1 to 3 years", settings.get(0).getChartTitle()); Assert.assertEquals("Age (months)", settings.get(0).getTopLabel()); Assert.assertEquals("Age (monthly)", settings.get(0).getBottomLabel()); Assert.assertEquals("Weight (kg)", settings.get(0).getLeftLabel()); Assert.assertEquals("Weight (kilos)", settings.get(0).getRightLabel()); }
@Override public List<MeasurementsChartConfiguration> loadConfigurationsForMeasurementType(String measurementType) { ResourceBundle configuration = ResourceBundle.getBundle("measurementsChartsConfigurations"); String key = "charts." + measurementType + ".configurations"; if (!configuration.containsKey(key)) { return Collections.emptyList(); } String[] charts = configuration.getString(key).split(","); List<MeasurementsChartConfiguration> result = new ArrayList<>(charts.length); for (String chart : charts) { SimpleMeasurementsChartConfiguration chartSettings = loadChart(key + '.' + chart + '.', configuration); if (validateChart(chartSettings)) { chartSettings.measurementType = measurementType; result.add(chartSettings); } } return result; }
DefaultMeasurementsChartConfigurationsFactory implements MeasurementsChartConfigurationsFactory { @Override public List<MeasurementsChartConfiguration> loadConfigurationsForMeasurementType(String measurementType) { ResourceBundle configuration = ResourceBundle.getBundle("measurementsChartsConfigurations"); String key = "charts." + measurementType + ".configurations"; if (!configuration.containsKey(key)) { return Collections.emptyList(); } String[] charts = configuration.getString(key).split(","); List<MeasurementsChartConfiguration> result = new ArrayList<>(charts.length); for (String chart : charts) { SimpleMeasurementsChartConfiguration chartSettings = loadChart(key + '.' + chart + '.', configuration); if (validateChart(chartSettings)) { chartSettings.measurementType = measurementType; result.add(chartSettings); } } return result; } }
DefaultMeasurementsChartConfigurationsFactory implements MeasurementsChartConfigurationsFactory { @Override public List<MeasurementsChartConfiguration> loadConfigurationsForMeasurementType(String measurementType) { ResourceBundle configuration = ResourceBundle.getBundle("measurementsChartsConfigurations"); String key = "charts." + measurementType + ".configurations"; if (!configuration.containsKey(key)) { return Collections.emptyList(); } String[] charts = configuration.getString(key).split(","); List<MeasurementsChartConfiguration> result = new ArrayList<>(charts.length); for (String chart : charts) { SimpleMeasurementsChartConfiguration chartSettings = loadChart(key + '.' + chart + '.', configuration); if (validateChart(chartSettings)) { chartSettings.measurementType = measurementType; result.add(chartSettings); } } return result; }  }
DefaultMeasurementsChartConfigurationsFactory implements MeasurementsChartConfigurationsFactory { @Override public List<MeasurementsChartConfiguration> loadConfigurationsForMeasurementType(String measurementType) { ResourceBundle configuration = ResourceBundle.getBundle("measurementsChartsConfigurations"); String key = "charts." + measurementType + ".configurations"; if (!configuration.containsKey(key)) { return Collections.emptyList(); } String[] charts = configuration.getString(key).split(","); List<MeasurementsChartConfiguration> result = new ArrayList<>(charts.length); for (String chart : charts) { SimpleMeasurementsChartConfiguration chartSettings = loadChart(key + '.' + chart + '.', configuration); if (validateChart(chartSettings)) { chartSettings.measurementType = measurementType; result.add(chartSettings); } } return result; }  @Override List<MeasurementsChartConfiguration> loadConfigurationsForMeasurementType(String measurementType); }
DefaultMeasurementsChartConfigurationsFactory implements MeasurementsChartConfigurationsFactory { @Override public List<MeasurementsChartConfiguration> loadConfigurationsForMeasurementType(String measurementType) { ResourceBundle configuration = ResourceBundle.getBundle("measurementsChartsConfigurations"); String key = "charts." + measurementType + ".configurations"; if (!configuration.containsKey(key)) { return Collections.emptyList(); } String[] charts = configuration.getString(key).split(","); List<MeasurementsChartConfiguration> result = new ArrayList<>(charts.length); for (String chart : charts) { SimpleMeasurementsChartConfiguration chartSettings = loadChart(key + '.' + chart + '.', configuration); if (validateChart(chartSettings)) { chartSettings.measurementType = measurementType; result.add(chartSettings); } } return result; }  @Override List<MeasurementsChartConfiguration> loadConfigurationsForMeasurementType(String measurementType);  }