### Question:
ScaleImageTransformerImpl implements ImageTransformer { @Override public final Layer transform(Layer layer, final ValueMap properties) { if (properties == null || properties.isEmpty()) { log.warn("Transform [ {} ] requires parameters.", TYPE); return layer; } log.debug("Transforming with [ {} ]", TYPE); Double scale = properties.get(KEY_SCALE, 1D); String round = StringUtils.trim(properties.get(KEY_ROUND, String.class)); if (scale == null) { log.warn("Could not derive a Double value for key [ {} ] from value [ {} ]", KEY_SCALE, properties.get(KEY_SCALE, String.class)); scale = 1D; } if (scale != 1D) { int currentWidth = layer.getWidth(); int currentHeight = layer.getHeight(); double newWidth = scale * currentWidth; double newHeight = scale * currentHeight; if (StringUtils.equals(ROUND_UP, round)) { newWidth = (int) Math.ceil(newWidth); newHeight = (int) Math.ceil(newHeight); } else if (StringUtils.equals(ROUND_DOWN, round)) { newWidth = (int) Math.floor(newWidth); newHeight = (int) Math.floor(newHeight); } else { newWidth = (int) Math.round(newWidth); newHeight = (int) Math.round(newHeight); } final ValueMap params = new ValueMapDecorator(new HashMap<String, Object>()); params.put(ResizeImageTransformerImpl.KEY_WIDTH, (int)newWidth); params.put(ResizeImageTransformerImpl.KEY_HEIGHT, (int)newHeight); layer = resizeImageTransformer.transform(layer, params); } return layer; }  @Override final Layer transform(Layer layer, final ValueMap properties);  }### Answer:
@Test public void testTransform_withMalformedScale() throws Exception { properties.put("scale", "50%"); transformer.transform(layer, properties); verifyNoMoreInteractions(layer); }
@Test public void testTransform_scaleAsDouble() throws Exception { properties.put("scale", ".50"); transformer.transform(layer, properties); verify(layer, times(1)).resize(800, 450); }
@Test public void testTransform_scaleAsDouble2() throws Exception { properties.put("scale", "1.50"); transformer.transform(layer, properties); verify(layer, times(1)).resize(2400, 1350); }
@Test public void testTransform_roundDefault() throws Exception { properties.put("scale", ".3333"); transformer.transform(layer, properties); verify(layer, times(1)).resize(533, 300); }
@Test public void testTransform_roundUp() throws Exception { properties.put("scale", ".3333"); properties.put("round", "up"); transformer.transform(layer, properties); verify(layer, times(1)).resize(534, 300); }
@Test public void testTransform_roundDown() throws Exception { properties.put("scale", ".3333"); properties.put("round", "down"); transformer.transform(layer, properties); verify(layer, times(1)).resize(533, 299); }
@Test public void testTransform_emptyParams() throws Exception { transformer.transform(layer, properties); verifyNoInteractions(layer); }
@Test public void testTransform_nullParams() throws Exception { transformer.transform(layer, null); verifyNoInteractions(layer); }