@Test public void loadChartWithDefaultValues() throws ComponentLookupException { List<MeasurementsChartConfiguration> settings = this.mocker.getComponentUnderTest().loadConfigurationsForMeasurementType("tested"); Assert.assertEquals("tested", settings.get(1).getMeasurementType()); Assert.assertEquals(0, settings.get(1).getLowerAgeLimit()); Assert.assertEquals(240, settings.get(1).getUpperAgeLimit()); Assert.assertEquals(6, settings.get(1).getAgeTickStep()); Assert.assertEquals(12, settings.get(1).getAgeLabelStep()); Assert.assertEquals(0.0, settings.get(1).getLowerValueLimit(), 1.0E-2); Assert.assertEquals(20.0, settings.get(1).getUpperValueLimit(), 1.0E-2); Assert.assertEquals(0.2, settings.get(1).getValueTickStep(), 1.0E-2); Assert.assertEquals(1.0, settings.get(1).getValueLabelStep(), 1.0E-2); Assert.assertEquals("Weight for age, birth to 20 years", settings.get(1).getChartTitle()); Assert.assertEquals("Age (years)", settings.get(1).getTopLabel()); Assert.assertEquals("Age (years)", settings.get(1).getBottomLabel()); Assert.assertEquals("Weight (kg)", settings.get(1).getLeftLabel()); Assert.assertEquals("Weight (kg)", settings.get(1).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);  }