### Question:
ImageUtil { public static BufferedImage grayscaleImage(final BufferedImage image) { final Image grayImage = GrayFilter.createDisabledImage(image); return ImageUtil.bufferedImageFromImage(grayImage); }  static BufferedImage bufferedImageFromImage(final Image image); static BufferedImage grayscaleOffset(final BufferedImage image, final int offset); static BufferedImage grayscaleOffset(final BufferedImage image, final float percentage); static BufferedImage alphaOffset(final BufferedImage image, final int offset); static BufferedImage alphaOffset(final BufferedImage image, final float percentage); static BufferedImage grayscaleImage(final BufferedImage image); static BufferedImage resizeImage(final BufferedImage image, final int newWidth, final int newHeight); static BufferedImage resizeCanvas(final BufferedImage image, final int newWidth, final int newHeight); static BufferedImage rotateImage(final BufferedImage image, final double theta); static BufferedImage flipImage(final BufferedImage image, final boolean horizontal, final boolean vertical); static BufferedImage outlineImage(final BufferedImage image, final Color color); static BufferedImage outlineImage(final BufferedImage image, final Color color, final Predicate<Color> fillCondition); static BufferedImage outlineImage(final BufferedImage image, final Color color, final Boolean outlineCorners); static BufferedImage outlineImage(final BufferedImage image, final Color color, final Predicate<Color> fillCondition, final Boolean outlineCorners); static BufferedImage getResourceStreamFromClass(final Class c, final String path); static BufferedImage fillImage(final BufferedImage image, final Color color); static SpritePixels getImageSpritePixels(BufferedImage image, Client client);  }### Answer:
@Test public void grayscaleImage() { final BufferedImage[] grayscaleColors = new BufferedImage[] { oneByOne(WHITE), oneByOne(GRAY), oneByOne(BLACK), oneByOne(BLACK_HALF_TRANSPARENT), oneByOne(BLACK_TRANSPARENT), }; final BufferedImage[] nonGrayscaleColors = new BufferedImage[] { oneByOne(RED), oneByOne(GREEN), oneByOne(BLUE), }; for (BufferedImage image : grayscaleColors) { assertTrue(isGrayscale(image)); } for (BufferedImage image : nonGrayscaleColors) { assertFalse(isGrayscale(image)); } for (BufferedImage image : ArrayUtils.addAll(grayscaleColors, nonGrayscaleColors)) { assertTrue(isGrayscale(ImageUtil.grayscaleImage(image))); } }
@Test public void grayscaleImage() { final BufferedImage[] grayscaleColors = new BufferedImage[] { oneByOne(WHITE), oneByOne(GRAY), oneByOne(BLACK), oneByOne(BLACK_HALF_TRANSPARENT), oneByOne(BLACK_TRANSPARENT), }; final BufferedImage[] nonGrayscaleColors = new BufferedImage[] { oneByOne(RED), oneByOne(GREEN), oneByOne(BLUE), }; for (BufferedImage image : grayscaleColors) { assert(isGrayscale(image)); } for (BufferedImage image : nonGrayscaleColors) { assert(!isGrayscale(image)); } for (BufferedImage image : ArrayUtils.addAll(grayscaleColors, nonGrayscaleColors)) { assert(isGrayscale(ImageUtil.grayscaleImage(image))); } }