Skip to content

Commit

Permalink
Merge branch 'main' into completed
Browse files Browse the repository at this point in the history
  • Loading branch information
tboychuk committed Jan 29, 2024
2 parents a0c544a + 62ad97f commit 648a6d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.bobocode.util.EntityManagerUtil;
import org.apache.commons.lang3.RandomStringUtils;
import org.hibernate.Session;
import org.hibernate.exception.ConstraintViolationException;
import org.junit.jupiter.api.*;

import jakarta.persistence.*;
Expand All @@ -15,6 +16,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType;
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
Expand Down Expand Up @@ -66,8 +68,8 @@ void saveBookWithDuplicateIsbn() {
Book bookWithDuplicateIsbn = createRandomBook();
bookWithDuplicateIsbn.setIsbn(book.getIsbn());

assertThatExceptionOfType(RollbackException.class).isThrownBy(() ->
emUtil.performWithinTx(entityManager -> entityManager.persist(bookWithDuplicateIsbn)));
assertThatThrownBy(() -> emUtil.performWithinTx(entityManager -> entityManager.persist(bookWithDuplicateIsbn)))
.isInstanceOfAny(RollbackException.class, ConstraintViolationException.class);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void saveNewComments() {

@Test
@Order(16)
@DisplayName("Add a new comment")
@DisplayName("Add new comments")
void addNewComments() {
Photo photo = createRandomPhoto();
emUtil.performWithinTx(entityManager -> entityManager.persist(photo));
Expand Down

0 comments on commit 648a6d5

Please sign in to comment.