### Question:
ImageControllerUtils { public ResponseEntity<String> prepareResponse( MultipartFile file, HttpHeaders responseHeaders, Map<String, String> responseContent) throws IOException, ImageProcessException { imageService.validateImageFormat(file); byte[] bytes = file.getBytes(); imageService.validateImageSize(bytes); prepareNormalResponse(bytes, responseContent); String body = getResponceJSONString(responseContent); return new ResponseEntity<>(body, responseHeaders, HttpStatus.OK); } ImageControllerUtils(ImageService imageService, JSONUtils jsonUtils); ResponseEntity<String> prepareResponse(
            MultipartFile file,
            HttpHeaders responseHeaders,
            Map<String, String> responseContent); String getResponceJSONString(Map<String, String> responseContent); void prepareResponse(byte[] bytes,
                                HttpServletResponse response,
                                Map<String, String> responseContent); void prepareNormalResponse(byte[] bytes, Map<String, String> responseContent); String convertImageToIcoInString64(byte[] imageBytes); byte[] getDefaultImage(); ImageService getImageService(); static final String STATUS; static final String SRC_PREFIX; static final String SRC_IMAGE; }### Answer:
@Test public void uploadAvatarForChromeAndFFShouldReturnPreviewInResponce() throws ImageProcessException { when(imageService.preProcessAndEncodeInString64(validAvatar)).thenReturn(IMAGE_BYTE_ARRAY_IN_BASE_64_STRING); when(imageService.getHtmlSrcImagePrefix()).thenReturn("jpeg"); MockHttpServletResponse response = new MockHttpServletResponse(); Map<String, String> responseContent = new HashMap<String, String>(); imageControllerUtils.prepareResponse(validAvatar, response, responseContent); verify(imageService).validateImageFormat(validAvatar); verify(imageService).validateImageSize(validAvatar); assertEquals(responseContent.get(imageControllerUtils.STATUS), "SUCCESS"); assertEquals(responseContent.get(imageControllerUtils.SRC_PREFIX), "jpeg"); assertEquals(responseContent.get(imageControllerUtils.SRC_IMAGE), IMAGE_BYTE_ARRAY_IN_BASE_64_STRING); assertEquals(response.getStatus(), HttpServletResponse.SC_OK); }