@Test public void getFavoritePlaceInfo_FavoritePlaceNotExist() { Exception exception = assertThrows( WrongIdException.class, () -> favoritePlaceService.getInfoFavoritePlace(2L)); String expectedMessage = ErrorMessage.FAVORITE_PLACE_NOT_FOUND; String actualMessage = exception.getMessage(); assertTrue(actualMessage.contains(expectedMessage)); }
@Override public PlaceInfoDto getInfoFavoritePlace(Long placeId) { log.info(LogMessage.IN_GET_ACCESS_PLACE_AS_FAVORITE_PLACE, placeId); FavoritePlace favoritePlace = findByPlaceId(placeId); PlaceInfoDto placeInfoDto = modelMapper.map( placeService .findById(favoritePlace.getPlace().getId()), PlaceInfoDto.class); placeInfoDto.setRate(placeService.averageRate(favoritePlace.getPlace().getId())); placeInfoDto.setName(favoritePlace.getName()); return placeInfoDto; }
FavoritePlaceServiceImpl implements FavoritePlaceService { @Override public PlaceInfoDto getInfoFavoritePlace(Long placeId) { log.info(LogMessage.IN_GET_ACCESS_PLACE_AS_FAVORITE_PLACE, placeId); FavoritePlace favoritePlace = findByPlaceId(placeId); PlaceInfoDto placeInfoDto = modelMapper.map( placeService .findById(favoritePlace.getPlace().getId()), PlaceInfoDto.class); placeInfoDto.setRate(placeService.averageRate(favoritePlace.getPlace().getId())); placeInfoDto.setName(favoritePlace.getName()); return placeInfoDto; } }
FavoritePlaceServiceImpl implements FavoritePlaceService { @Override public PlaceInfoDto getInfoFavoritePlace(Long placeId) { log.info(LogMessage.IN_GET_ACCESS_PLACE_AS_FAVORITE_PLACE, placeId); FavoritePlace favoritePlace = findByPlaceId(placeId); PlaceInfoDto placeInfoDto = modelMapper.map( placeService .findById(favoritePlace.getPlace().getId()), PlaceInfoDto.class); placeInfoDto.setRate(placeService.averageRate(favoritePlace.getPlace().getId())); placeInfoDto.setName(favoritePlace.getName()); return placeInfoDto; }  }
FavoritePlaceServiceImpl implements FavoritePlaceService { @Override public PlaceInfoDto getInfoFavoritePlace(Long placeId) { log.info(LogMessage.IN_GET_ACCESS_PLACE_AS_FAVORITE_PLACE, placeId); FavoritePlace favoritePlace = findByPlaceId(placeId); PlaceInfoDto placeInfoDto = modelMapper.map( placeService .findById(favoritePlace.getPlace().getId()), PlaceInfoDto.class); placeInfoDto.setRate(placeService.averageRate(favoritePlace.getPlace().getId())); placeInfoDto.setName(favoritePlace.getName()); return placeInfoDto; }  @Override FavoritePlaceDto save(FavoritePlaceDto favoritePlaceDto, String userEmail); @Override FavoritePlaceDto update(FavoritePlaceDto favoritePlaceDto, String userEmail); @Override List<FavoritePlaceDto> findAllByUserEmail(String email); @Override @Transactional Long deleteByUserEmailAndPlaceId(Long placeId, String userEmail); @Override FavoritePlace findByPlaceId(Long placeId); @Override PlaceInfoDto getInfoFavoritePlace(Long placeId); @Override PlaceByBoundsDto getFavoritePlaceWithLocation(Long placeId, String email); }
FavoritePlaceServiceImpl implements FavoritePlaceService { @Override public PlaceInfoDto getInfoFavoritePlace(Long placeId) { log.info(LogMessage.IN_GET_ACCESS_PLACE_AS_FAVORITE_PLACE, placeId); FavoritePlace favoritePlace = findByPlaceId(placeId); PlaceInfoDto placeInfoDto = modelMapper.map( placeService .findById(favoritePlace.getPlace().getId()), PlaceInfoDto.class); placeInfoDto.setRate(placeService.averageRate(favoritePlace.getPlace().getId())); placeInfoDto.setName(favoritePlace.getName()); return placeInfoDto; }  @Override FavoritePlaceDto save(FavoritePlaceDto favoritePlaceDto, String userEmail); @Override FavoritePlaceDto update(FavoritePlaceDto favoritePlaceDto, String userEmail); @Override List<FavoritePlaceDto> findAllByUserEmail(String email); @Override @Transactional Long deleteByUserEmailAndPlaceId(Long placeId, String userEmail); @Override FavoritePlace findByPlaceId(Long placeId); @Override PlaceInfoDto getInfoFavoritePlace(Long placeId); @Override PlaceByBoundsDto getFavoritePlaceWithLocation(Long placeId, String email);  }