@Test
public void testResize() throws Exception {

	checkImages((imageName, width, height, color, refImage, path, bs) -> {
		log.debug("Handling " + imageName);
		Single<byte[]> obs = manipulator
			.handleResize(createMockedBinary(path), new ImageManipulationParametersImpl().setWidth(150).setHeight(180))
			.map(file -> Files.readAllBytes(Paths.get(file)));
		CountDownLatch latch = new CountDownLatch(1);
		obs.subscribe(data -> {
			try {
				assertNotNull(data);
				try (ByteArrayInputStream bis = new ByteArrayInputStream(data)) {
					BufferedImage resizedImage = ImageIO.read(bis);
					String referenceFilename = "outputImage-" + imageName.replace(".", "_") + "-resize-reference.png";
					// when you want to update the referenceImage, execute the code below
					// and copy the files to src/test/resources/references/
					// ImageTestUtil.writePngImage(resizedImage, new File("target/" + referenceFilename));
					// ImageTestUtil.displayImage(resizedImage);
					assertThat(resizedImage).as(imageName).hasSize(150, 180).matchesReference(referenceFilename);
				}
			} catch (Exception e) {
				e.printStackTrace();
				fail("Error occured");
			}
			latch.countDown();
		});
		try {
			if (!latch.await(20, TimeUnit.SECONDS)) {
				fail("Timeout reached");
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	});
}