@Test
public void testPaint() throws IOException {

  BufferedImage sample = getSampleImage();
  ImagePool.Image image = myPool.create(50, 50, BufferedImage.TYPE_INT_ARGB, null);
  image.paint((g) -> {
    g.setColor(Color.RED);
    g.fillRect(0, 0, 25, 50);
  });
  boolean threw = false;
  try {
    ImageDiffUtil.assertImageSimilar("sample", sample, image.getCopy(), 0.0);
  }
  catch (AssertionError ignored) {
    threw = true;
  }
  assertTrue("Images must be different", threw);
  image.paint((g) -> {
    g.setColor(Color.RED);
    g.fillRect(0, 0, 25, 50);
    g.setColor(Color.BLUE);
    g.fillRect(25, 0, 25, 50);
  });
  ImageDiffUtil.assertImageSimilar("sample", sample, image.getCopy(), 0.0);
  image.paint((g) -> {
    // This is a valid way to make modifications into the image and shouldn't break anything
    image.drawImageTo(g, 0, 0, image.getWidth(), image.getHeight());
  });
  ImageDiffUtil.assertImageSimilar("sample", sample, image.getCopy(), 0.0);
}