From 555e3a836b97b70b5e6d49ed34bd5dc93a98d4e3 Mon Sep 17 00:00:00 2001 From: JJimini Date: Thu, 26 Sep 2024 14:54:10 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=8A=A4=ED=84=B0=EB=94=94=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=8B=9C=20=EC=82=AD=EC=A0=9C=EB=90=9C=20=EC=8A=A4?= =?UTF-8?q?=ED=84=B0=EB=94=94`(is=5Fdelete=20=3D=20true)`=EB=8F=84=20?= =?UTF-8?q?=ED=95=A8=EA=BB=98=20=EC=A1=B0=ED=9A=8C=EB=90=98=EB=8D=98=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/doore/study/domain/Study.java | 2 ++ .../doore/study/application/StudyCommandServiceTest.java | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/doore/study/domain/Study.java b/src/main/java/doore/study/domain/Study.java index 923570a7..86aa9458 100644 --- a/src/main/java/doore/study/domain/Study.java +++ b/src/main/java/doore/study/domain/Study.java @@ -19,10 +19,12 @@ import lombok.Getter; import lombok.NoArgsConstructor; import org.hibernate.annotations.SQLDelete; +import org.hibernate.annotations.SQLRestriction; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) +@SQLRestriction("is_deleted = false") @SQLDelete(sql = "UPDATE study SET is_deleted = true where id = ?") public class Study extends BaseEntity { diff --git a/src/test/java/doore/study/application/StudyCommandServiceTest.java b/src/test/java/doore/study/application/StudyCommandServiceTest.java index d8f63531..aa3853f6 100644 --- a/src/test/java/doore/study/application/StudyCommandServiceTest.java +++ b/src/test/java/doore/study/application/StudyCommandServiceTest.java @@ -19,7 +19,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import doore.helper.IntegrationTest; @@ -240,7 +239,7 @@ void setUp() { void deleteStudy_정상적으로_스터디를_삭제할_수_있다_성공() throws Exception { studyCommandService.deleteStudy(study.getId(), memberId); final List studies = studyRepository.findAll(); - assertTrue(studies.get(0).getIsDeleted()); + assertThat(studies.size()).isEqualTo(0); } @Test @@ -254,8 +253,7 @@ void setUp() { study.getId()); assertThat(beforeCurriculumItems.size()).isEqualTo(2); - assertThat(afterCurriculumItems.get(0).getIsDeleted()).isEqualTo(true); - assertThat(afterCurriculumItems.get(1).getIsDeleted()).isEqualTo(true); + assertThat(afterCurriculumItems.size()).isEqualTo(0); } @Test