### Question:
ImageService { public void validateImageFormat(MultipartFile file) throws ImageFormatException { Validate.notNull(file, "file argument array cannot be null"); if (!VALID_IMAGE_TYPES.contains(file.getContentType())) { LOGGER.debug("Wrong file extension. May be only {}", VALID_IMAGE_EXTENSIONS); throw new ImageFormatException(VALID_IMAGE_EXTENSIONS); } } ImageService(
            ImageConverter imageConverter,
            Base64Wrapper base64Wrapper,
            String defaultImagePath,
            JCommuneProperty imageSizeProperty); byte[] getDefaultImage(); String preProcessAndEncodeInString64(byte[] bytes); void validateImageFormat(MultipartFile file); void validateImageFormat(byte[] bytes); void validateImageSize(byte[] bytes); String getHtmlSrcImagePrefix(); static final String ICO_TYPE; }### Answer:
@Test(expectedExceptions = ImageFormatException.class, dataProvider = "invalidFormatValues") public void validateImageFormatShouldNotConsiderIncorrectFormatsAsValid(MultipartFile file) throws ImageFormatException { imageService.validateImageFormat(file); }
@Test(dataProvider = "validFormatValues") public void validateImageFormatShouldConsiderCorrectFormatsFromOperaAndIEAsValid(MultipartFile file) throws ImageFormatException { imageService.validateImageFormat(file); }
@Test(expectedExceptions = {IllegalArgumentException.class}) public void validateImageFormatInFileShouldNotWorkWithPassedNull() throws ImageFormatException { MultipartFile nullMultipartFile = null; imageService.validateImageFormat(nullMultipartFile); }
@Test(expectedExceptions = {IllegalArgumentException.class}) public void validateImageFormatInByteArrayShouldNotWorkWithPassedNull() throws ImageFormatException { byte[] nullByteArray = null; imageService.validateImageFormat(nullByteArray); }
@Test(dataProvider = "validFormatValuesForChromeFF") public void validateImageFormatShouldProcessValidValuesForChromeFF(byte[] bytes) throws ImageFormatException { imageService.validateImageFormat(bytes); }
@Test(dataProvider = "invalidFormatValuesForChromeFF", expectedExceptions = ImageFormatException.class) public void validateImageFormatShouldNotProcessInvalidValuesForChromeFF(byte[] bytes) throws ImageFormatException { imageService.validateImageFormat(bytes); }