### Question:
ResizeImageTransformerImpl implements ImageTransformer { @Override public final Layer transform(final Layer layer, final ValueMap properties) { if (properties == null || properties.isEmpty()) { log.warn("Transform [ {} ] requires parameters.", TYPE); return layer; } log.debug("Transforming with [ {} ]", TYPE); int width = properties.get(KEY_WIDTH, properties.get(KEY_WIDTH_ALIAS, 0)); int height = properties.get(KEY_HEIGHT, properties.get(KEY_HEIGHT_ALIAS, 0)); if (width > maxDimension) { width = maxDimension; } if (height > maxDimension) { height = maxDimension; } if (width < 1 && height < 1) { width = layer.getWidth(); height = layer.getHeight(); } else if (width < 1) { final float aspect = (float) height / layer.getHeight(); width = Math.round(layer.getWidth() * aspect); } else if (height < 1) { final float aspect = (float) width / layer.getWidth(); height = Math.round(layer.getHeight() * aspect); } layer.resize(width, height); return layer; }  @Override final Layer transform(final Layer layer, final ValueMap properties); @Property(label = "Max dimension in px",
            description = "Maximum size height and width can be re-sized to. [ Default: 50000 ]",
            intValue = DEFAULT_MAX_DIMENSION)
    static final String PROP_MAX_DIMENSION; }### Answer:
@Test public void testTransform() throws Exception { final int width = 100; final int height = 200; map.put("width", width); map.put("height", height); ValueMap properties = new ValueMapDecorator(map); transformer.transform(layer, properties); verify(layer, times(1)).resize(width, height); verifyNoMoreInteractions(layer); }
@Test public void testTransform_onlyWidth() throws Exception { final int width = 160; map.put("width", width); ValueMap properties = new ValueMapDecorator(map); transformer.transform(layer, properties); verify(layer, times(1)).resize(width, 90); }
@Test public void testTransform_onlyHeight() throws Exception { final int height = 90; map.put("height", height); ValueMap properties = new ValueMapDecorator(map); transformer.transform(layer, properties); verify(layer, times(1)).resize(160, height); }
@Test public void testTransform_invalidHeightAndWidth() throws Exception { final int width = -100; final int height = -200; map.put("width", width); map.put("height", height); ValueMap properties = new ValueMapDecorator(map); transformer.transform(layer, properties); verify(layer, times(1)).resize(1600, 900); }
@Test public void testTransform_invalidWifth() throws Exception { final int width = -100; final int height = 90; map.put("width", width); map.put("height", height); ValueMap properties = new ValueMapDecorator(map); transformer.transform(layer, properties); verify(layer, times(1)).resize(160, height); }
@Test public void testTransform_invalidHeight() throws Exception { final int width = 160; final int height = -100; map.put("width", width); map.put("height", height); ValueMap properties = new ValueMapDecorator(map); transformer.transform(layer, properties); verify(layer, times(1)).resize(width, 90); }
@Test public void testTransform_emptyParams() throws Exception { ValueMap properties = new ValueMapDecorator(map); transformer.transform(layer, properties); verifyNoInteractions(layer); }
@Test public void testTransform_nullParams() throws Exception { transformer.transform(layer, null); verifyNoInteractions(layer); }