Skip to content

Commit

Permalink
Try fixing failing integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
KianKwa committed Nov 27, 2024
1 parent 746e219 commit 4a3737f
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package uk.gov.hmcts.reform.pip.account.management.database;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
Expand All @@ -20,6 +21,7 @@
@ActiveProfiles("integration-jpa")
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class AuditRepositoryTest {
private static final String USER_ID1 = "123";
private static final String USER_ID2 = "124";
Expand All @@ -37,7 +39,7 @@ class AuditRepositoryTest {
@Autowired
AuditRepository auditRepository;

@BeforeEach
@BeforeAll
void setup() {
AuditLog auditLog1 = new AuditLog();
auditLog1.setUserId(USER_ID1);
Expand Down Expand Up @@ -69,7 +71,7 @@ void setup() {
auditRepository.saveAll(List.of(auditLog1, auditLog2, auditLog3));
}

@AfterEach
@AfterAll
void shutdown() {
auditRepository.deleteAll();
}
Expand Down

0 comments on commit 4a3737f

Please sign in to comment.