Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ndkhanh-axonivy committed Jul 24, 2024
1 parent e908c83 commit 86859af
Show file tree
Hide file tree
Showing 4 changed files with 287 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ public List<ProductRating> getProductRatingById(String productId) {
}).toList();
}

private void validateProductExists(String productId) throws NotFoundException {
public void validateProductExists(String productId) throws NotFoundException {
if (productRepository.findById(productId).isEmpty()) {
throw new NotFoundException(ErrorCode.PRODUCT_NOT_FOUND, "Not found product with id: " + productId);
}
}

private void validateUserExists(String userId) {
public void validateUserExists(String userId) {
if (userRepository.findById(userId).isEmpty()) {
throw new NotFoundException(ErrorCode.USER_NOT_FOUND, "Not found user with id: " + userId);
}
Expand Down
Loading

0 comments on commit 86859af

Please sign in to comment.