diff --git a/src/integrationTest/java/uk/gov/hmcts/darts/noderegistration/controller/NodeRegistrationControllerTest.java b/src/integrationTest/java/uk/gov/hmcts/darts/noderegistration/controller/NodeRegistrationControllerTest.java index c5fd725086c..f65e1a077a6 100644 --- a/src/integrationTest/java/uk/gov/hmcts/darts/noderegistration/controller/NodeRegistrationControllerTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/darts/noderegistration/controller/NodeRegistrationControllerTest.java @@ -1,7 +1,9 @@ package uk.gov.hmcts.darts.noderegistration.controller; import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; @@ -10,7 +12,6 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.transaction.annotation.Transactional; import uk.gov.hmcts.darts.authorisation.component.UserIdentity; import uk.gov.hmcts.darts.common.entity.CourthouseEntity; import uk.gov.hmcts.darts.common.entity.CourtroomEntity; @@ -34,7 +35,6 @@ @Slf4j @AutoConfigureMockMvc -@Transactional class NodeRegistrationControllerTest extends IntegrationBase { @Autowired @@ -43,6 +43,15 @@ class NodeRegistrationControllerTest extends IntegrationBase { @MockitoBean private UserIdentity mockUserIdentity; + @BeforeEach + void startHibernateSession() { + openInViewUtil.openEntityManager(); + } + + @AfterEach + void closeHibernateSession() { + openInViewUtil.closeEntityManager(); + } @Test void testPostRegisterDevices() throws Exception { diff --git a/src/main/java/uk/gov/hmcts/darts/common/service/RetrieveCoreObjectService.java b/src/main/java/uk/gov/hmcts/darts/common/service/RetrieveCoreObjectService.java index c9423fcda18..29d511e97d0 100644 --- a/src/main/java/uk/gov/hmcts/darts/common/service/RetrieveCoreObjectService.java +++ b/src/main/java/uk/gov/hmcts/darts/common/service/RetrieveCoreObjectService.java @@ -43,7 +43,7 @@ HearingEntity retrieveOrCreateHearing(String courthouseName, String courtroomNam * Retrieve or create a case and link to media. * @deprecated This method is only used by tests. Tests should be refactored and this method should be removed. */ - @Deprecated + @Deprecated(since = "04/02/2025") HearingEntity retrieveOrCreateHearingWithMedia(String courthouseName, String courtroomName, String caseNumber, LocalDateTime hearingDate, UserAccountEntity userAccount, MediaEntity mediaEntity); @@ -52,7 +52,7 @@ HearingEntity retrieveOrCreateHearingWithMedia(String courthouseName, String cou * @deprecated This method is only used by tests. * Tests should be refactored to use the other `retrieveOrCreateCourtroom` method, and this method should be removed. */ - @Deprecated + @Deprecated(since = "04/02/2025") CourtroomEntity retrieveOrCreateCourtroom(CourthouseEntity courthouse, String courtroomName, UserAccountEntity userAccount); /** @@ -87,7 +87,7 @@ HearingEntity retrieveOrCreateHearingWithMedia(String courthouseName, String cou * @deprecated This method is only used by tests. * Tests should be refactored to use the other `retrieveOrCreateCase` method, and this method should be removed. */ - @Deprecated + @Deprecated(since = "04/02/2025") CourtCaseEntity retrieveOrCreateCase(String courthouseName, String caseNumber, UserAccountEntity userAccount); /**