### Question:
MovieServiceImpl implements MovieService { @Override public void unlikeMovie(final String account, final UUID movieId) throws MovieNotFoundException { final String url = String.format(UNLIKE_URL, serviceProperties.getMovieServiceUrl(), movieId, account, LocaleContextHolder.getLocale().getLanguage()); try { retryHandler.run( () -> { final ResponseEntity<Void> response = restTemplate.getForEntity(url, Void.class); if (response.getStatusCode().equals(HttpStatus.CONFLICT)) { throw new MovieConditionalException(); } if (response.getStatusCode().equals(HttpStatus.NOT_FOUND)) { throw new MovieNotFoundException(); } return response.getBody(); }, ex -> ex instanceof MovieConditionalException); } catch (final MovieNotFoundException ex) { throw ex; } catch (final Exception ex) { final String errorMessage = String.format("An error occured while unliking movie %s (%s): %s", movieId, account, ex.getMessage()); log.error(errorMessage, ex); throw new MoviePersistenceException(errorMessage, ex); } }  @Override MoviePagedResultModel searchMovies(final String text, final int pageNumber, final String sortField,
        final boolean isAscending); @Override MovieResultModel createMovie(final MovieDto movieDto); @Override MovieDto getMovie(final UUID id); @Override boolean isAuthorizedOnMovie(final String account, final UUID movieId); @Override boolean isAuthorizedOnMovie(final String account, final MovieDto movieDto); @Override MovieResultModel updateMovie(final MovieDto movieDto); @Override void deleteMovie(final UUID movieId); @Override void likeMovie(final String account, final UUID movieId); @Override void unlikeMovie(final String account, final UUID movieId); @Override boolean hasLiked(final String account, final UUID movieId);  }### Answer:
@Test public void test_unlikeMovie_success() throws Exception { final String account = "test_account"; final UUID movieId = UUID.randomUUID(); final String url = MOVIE_SERVICE_URL + String.format(MOVIE_UNLIKE_PATH, movieId, account); when(voidResponse.getStatusCode()).thenReturn(HttpStatus.OK); when(restTemplate.getForEntity(url, Void.class)).thenReturn(voidResponse); movieService.unlikeMovie(account, movieId); verify(restTemplate).getForEntity(url, Void.class); }
@Test public void test_unlikeMovie_conflict() throws Exception { final String account = "test_account"; final UUID movieId = UUID.randomUUID(); final String url = MOVIE_SERVICE_URL + String.format(MOVIE_UNLIKE_PATH, movieId, account); when(voidResponse.getStatusCode()) .thenReturn(HttpStatus.CONFLICT) .thenReturn(HttpStatus.OK); when(restTemplate.getForEntity(url, Void.class)).thenReturn(voidResponse); movieService.unlikeMovie(account, movieId); verify(restTemplate, times(2)).getForEntity(url, Void.class); }
@Test(expected = MoviePersistenceException.class) public void test_unlikeMovie_exception() throws Exception { final String account = "test_account"; final UUID movieId = UUID.randomUUID(); final String url = MOVIE_SERVICE_URL + String.format(MOVIE_UNLIKE_PATH, movieId, account); when(restTemplate.getForEntity(url, Void.class)).thenThrow(new RuntimeException()); movieService.unlikeMovie(account, movieId); }
@Test(expected = MovieNotFoundException.class) public void test_unlikeMovie_notFound() throws Exception { final String account = "test_account"; final UUID movieId = UUID.randomUUID(); final String url = MOVIE_SERVICE_URL + String.format(MOVIE_UNLIKE_PATH, movieId, account); when(voidResponse.getStatusCode()).thenReturn(HttpStatus.NOT_FOUND); when(restTemplate.getForEntity(url, Void.class)).thenReturn(voidResponse); movieService.unlikeMovie(account, movieId); }