### Question:
ImageService { public void validateImageSize(byte[] bytes) throws ImageSizeException { Validate.notNull(bytes, "Incoming byte array cannot be null"); int maxSize = imageSizeProperty.intValue(); if (bytes.length > maxSize) { LOGGER.debug("File has too big size. Must be less than {} bytes", maxSize); throw new ImageSizeException(maxSize); } } 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 = IllegalArgumentException.class) public void validateImageSizeSholdNotContinueWithPassedNullValue() throws ImageSizeException { imageService.validateImageSize(null); }
@Test(expectedExceptions = ImageSizeException.class) public void validateImageSizeShouldNotConsiderAvatarWithIncorrectSizeAsValid() throws Exception { byte[] bytes = new byte[IMAGE_MAX_SIZE * 2]; imageService.validateImageSize(bytes); }
@Test public void validateImageSizeShouldConsiderAvatarWithCorrectSizeAsValid() throws ImageSizeException { byte[] bytes = new byte[IMAGE_MAX_SIZE]; imageService.validateImageSize(bytes); }