### Question:
MovieServiceImpl implements MovieService { @Override public MovieDto getMovie(final UUID id) throws MovieNotFoundException { final String url = String.format(GET_URL, serviceProperties.getMovieServiceUrl(), id, LocaleContextHolder.getLocale().getLanguage()); try { final ResponseEntity<MovieDto> response = restTemplate.getForEntity(url, MovieDto.class); if (response.getStatusCode().equals(HttpStatus.NOT_FOUND)) { throw new MovieNotFoundException(); } return response.getBody(); } catch (final MovieNotFoundException ex) { throw ex; } catch (final Exception ex) { final String errorMessage = String.format("An error occured while fetching movie %s", id, 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_getMovie_success() throws Exception { final UUID id = UUID.randomUUID(); final MovieDto expectedResult = mock(MovieDto.class); final String url = MOVIE_SERVICE_URL + String.format(MOVIE_GET_PATH, id); when(restTemplate.getForEntity(url, MovieDto.class)).thenReturn(movieDtoResponse); when(movieDtoResponse.getStatusCode()).thenReturn(HttpStatus.OK); when(movieDtoResponse.getBody()).thenReturn(expectedResult); final MovieDto result = movieService.getMovie(id); assertEquals(expectedResult, result); }
@Test(expected = MovieNotFoundException.class) public void test_getMovie_notFound() throws Exception { final UUID id = UUID.randomUUID(); final String url = MOVIE_SERVICE_URL + String.format(MOVIE_GET_PATH, id); when(restTemplate.getForEntity(url, MovieDto.class)).thenReturn(movieDtoResponse); when(movieDtoResponse.getStatusCode()).thenReturn(HttpStatus.NOT_FOUND); movieService.getMovie(id); }
@Test(expected = MoviePersistenceException.class) public void test_getMovie_exception() throws Exception { final UUID id = UUID.randomUUID(); final String url = MOVIE_SERVICE_URL + String.format(MOVIE_GET_PATH, id); when(restTemplate.getForEntity(url, MovieDto.class)).thenThrow(new RuntimeException()); movieService.getMovie(id); }