### Question:
TemplateVariables { double getScale(String figureKey) { final String propertyName = getPropertyNameFromDefault(figureKey); final String scalePropertyName = createScaleName(propertyName); final String scaleValueString = properties.getProperty(scalePropertyName); if (StringUtils.isNullOrEmpty(scaleValueString)) { return 0.2; } return Double.parseDouble(scaleValueString.trim()); } TemplateVariables();   }### Answer:
@Test public void testGetScale() throws IOException { final String properties = "figure.one.default=a_valid_default_figure\n" + "strange.key=somethingElse\n" + "figure.one.scale=0.45\n" + "figure.second=another_figure\n" + "figure.second.scale=0.56"; final ByteArrayInputStream inputStream = new ByteArrayInputStream(properties.getBytes()); variables.load(inputStream); assertEquals(0.45, variables.getScale("figure.one"), 1e-8); assertEquals(0.56, variables.getScale("figure.second"), 1e-8); }
@Test public void testGetScale_defaultValue() { assertEquals(0.2, variables.getScale("figure.not_defined"), 1e-8); }