Skip to content

Commit b935d66

Browse files
committed
Fix: "Mongo 저장 실패 시 updateSave 롤백" 테스트 수정
1 parent 2bfb163 commit b935d66

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/java/io/ejangs/docsa/domain/save/app/SaveServiceIntegrationTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import io.ejangs.docsa.global.exception.CustomException;
2424
import io.ejangs.docsa.global.exception.errorcode.DatabaseErrorCode;
2525
import io.ejangs.docsa.global.exception.errorcode.SaveErrorCode;
26+
import jakarta.persistence.EntityManager;
2627
import java.time.LocalDateTime;
2728
import java.util.List;
2829
import java.util.Map;
@@ -61,6 +62,9 @@ class SaveServiceIntegrationTest {
6162
@Autowired
6263
private CommitRepository commitRepository;
6364

65+
@Autowired
66+
private EntityManager em;
67+
6468
@MockitoBean
6569
private SaveContentRepository saveContentRepository;
6670

@@ -126,6 +130,8 @@ void updateSave_fails_whenMongoSaveFails_thenMysqlDeleted() throws Exception {
126130
.hasMessageContaining(DatabaseErrorCode.DATABASE_ERROR.getMessage());
127131

128132
// then
133+
em.clear();
134+
129135
Save after = saveRepository.findById(save.getId()).orElse(null);
130136
assertThat(after).isNotNull();
131137
assertThat(after.getUpdatedAt()).isEqualTo(beforeUpdatedAt);

0 commit comments

Comments
 (0)