Chcę przetestować metodę https://github.com/JonkiPro/popcorn/blob/develop/popcorn-core/src/main/java/com/jonki/popcorn/core/jpa/service/MoviePersistenceServiceImpl.java#L153. Klasa ma adnotację @Transactional, a listy encji są LAZY. Po uruchomieniu aplikacji metoda działa bez problemu, nie ma problemu z ładowaniem list encji. Problem pojawia się podczas testów. Mam napisany test

   @Test
public void canCreateOtherTitle() throws ResourceException {
    ...

    this.moviePersistenceService.createOtherTitle(
            otherTitle,
            this.movieRepository.findByIdAndStatus(MOV_1_ID, DataStatus.ACCEPTED)
                    .orElseThrow(IllegalArgumentException::new)
    );

   ...
}

po uruchomieniu go otrzymuję wyjątek

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.jonki.popcorn.core.jpa.entity.MovieEntity.otherTitles, could not initialize proxy - no Session 

w linii

at com.jonki.popcorn.core.jpa.service.MoviePersistenceServiceImpl.createOtherTitle(MoviePersistenceServiceImpl.java:162)

czyli tutaj https://github.com/JonkiPro/popcorn/blob/develop/popcorn-core/src/main/java/com/jonki/popcorn/core/jpa/service/MoviePersistenceServiceImpl.java#L162

Dlaczego to się dzieje? Metoda działa poprawnie podczas normalnej pracy aplikacji, ale podczas testów wyrzuca wyjątek.

Chciałem dodać adnotację

@Test
@Transactional

ale wtedy wyrzuca

Cannot start new transaction without ending existing transaction

Cały test https://pastebin.com/fewHBUff