1
I want to create a unitary test for the method:
public BufferedImage negativo(BufferedImage image) {
int width = image.getWidth();
int height = image.getHeight();
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
int rgb = image.getRGB(i, j);
int r = 255 - (int)((rgb&0x00FF0000)>>>16);
int g = 255 - (int)((rgb&0x0000FF00)>>>8);
int b = 255 - (int) (rgb&0x000000FF);
Color color = new Color(r, g, b);
image.setRGB(i, j, color.getRGB());
}
}
return image;
}
Someone has a solution?
Any solution to which problem? It’s not even clear. Yes, I know you want to do a unit test... but it will test what?
– Luiz Vieira
if the filter is being applied to the image that was generated.
– gessica
It’s not very clear what your question is... don’t you know how to test? I would probably choose some small test images and compare them with fixed expected values (e.g., pixel by pixel). Have a look in Soen’s reply.
– Anthony Accioly