From a163ab81488a86feae118b5738ad3db42f1d9b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=80=EB=B9=84?= <67318165+eunbii0213@users.noreply.github.com> Date: Thu, 3 Aug 2023 16:05:31 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AA=A8=EB=93=A0=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20=EA=B0=9D=EC=B2=B4=20exception=20Notnull=20method?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0=20(#184)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: domain exception을 server exception을 상속받도록 수정 * refactor: 사용하지 않는 MemberException 제거 * refactor: 모든 도메인 객체 exception Notnull method 제거 * refactor: stream 컨벤션에 맞도록 수정 * refactor: conflict 해결 * test: 에러메세지 수정 * refactor: TagException 상세히 분할(RunnerPostTag, SupporterTechnicalTag) * refactor: TagException 상세히 분할(RunnerPostTag, SupporterTechnicalTag)에 따른 테스트 수정 * refactor: stream 점 위치 수정 --- .../touch/baton/domain/runner/Runner.java | 8 ++--- .../runner/exception/OldRunnerException.java | 22 ------------ .../exception/RunnerDomainException.java | 1 - .../domain/runner/service/RunnerService.java | 4 +-- .../baton/domain/runnerpost/RunnerPost.java | 20 +++++------ .../OldRunnerPostBusinessException.java | 17 --------- .../exception/OldRunnerPostException.java | 15 -------- .../runnerpost/service/RunnerPostService.java | 18 ++++------ .../baton/domain/supporter/Supporter.java | 14 ++++---- .../exception/OldSupporterException.java | 15 -------- .../touch/baton/domain/tag/RunnerPostTag.java | 6 ++-- .../main/java/touch/baton/domain/tag/Tag.java | 6 ++-- .../domain/tag/exception/OldTagException.java | 15 -------- .../RunnerPostTagDomainException.java | 10 ++++++ .../SupporterTechnicalTagDomainException.java | 10 ++++++ .../TechnicalTagDomainException.java | 10 ++++++ .../technicaltag/SupporterTechnicalTag.java | 6 ++-- .../domain/technicaltag/TechnicalTag.java | 4 +-- .../touch/baton/domain/runner/RunnerTest.java | 11 +++--- .../runner/service/RunnerServiceReadTest.java | 4 +-- .../domain/runnerpost/RunnerPostTest.java | 36 +++++++++++++------ .../service/RunnerPostServiceDeleteTest.java | 8 +++-- .../service/RunnerPostServiceReadTest.java | 5 +-- .../baton/domain/supporter/SupporterTest.java | 17 +++++---- .../baton/domain/tag/RunnerPostTagTest.java | 9 +++-- .../java/touch/baton/domain/tag/TagTest.java | 9 ++--- .../SupporterTechnicalTagTest.java | 9 +++-- .../domain/technicaltag/TechnicalTagTest.java | 6 ++-- 28 files changed, 146 insertions(+), 169 deletions(-) delete mode 100644 backend/baton/src/main/java/touch/baton/domain/runner/exception/OldRunnerException.java delete mode 100644 backend/baton/src/main/java/touch/baton/domain/runnerpost/exception/OldRunnerPostBusinessException.java delete mode 100644 backend/baton/src/main/java/touch/baton/domain/runnerpost/exception/OldRunnerPostException.java delete mode 100644 backend/baton/src/main/java/touch/baton/domain/supporter/exception/OldSupporterException.java delete mode 100644 backend/baton/src/main/java/touch/baton/domain/tag/exception/OldTagException.java create mode 100644 backend/baton/src/main/java/touch/baton/domain/tag/exception/RunnerPostTagDomainException.java create mode 100644 backend/baton/src/main/java/touch/baton/domain/tag/exception/SupporterTechnicalTagDomainException.java create mode 100644 backend/baton/src/main/java/touch/baton/domain/tag/exception/TechnicalTagDomainException.java diff --git a/backend/baton/src/main/java/touch/baton/domain/runner/Runner.java b/backend/baton/src/main/java/touch/baton/domain/runner/Runner.java index 0dc4eca31..57e0edf16 100644 --- a/backend/baton/src/main/java/touch/baton/domain/runner/Runner.java +++ b/backend/baton/src/main/java/touch/baton/domain/runner/Runner.java @@ -17,7 +17,7 @@ import touch.baton.domain.common.vo.Introduction; import touch.baton.domain.common.vo.TotalRating; import touch.baton.domain.member.Member; -import touch.baton.domain.runner.exception.OldRunnerException; +import touch.baton.domain.runner.exception.RunnerDomainException; import java.util.Objects; @@ -74,15 +74,15 @@ private Runner(final Long id, private void validateNotNull(final TotalRating totalRating, final Grade grade, final Member member) { if (Objects.isNull(totalRating)) { - throw new OldRunnerException.NotNull("totalRating 은 null 일 수 없습니다."); + throw new RunnerDomainException("Runner 의 totalRating 은 null 일 수 없습니다."); } if (Objects.isNull(grade)) { - throw new OldRunnerException.NotNull("grade 는 null 일 수 없습니다."); + throw new RunnerDomainException("Runner 의 grade 는 null 일 수 없습니다."); } if (Objects.isNull(member)) { - throw new OldRunnerException.NotNull("member 는 null 일 수 없습니다."); + throw new RunnerDomainException("Runner 의 member 는 null 일 수 없습니다."); } } diff --git a/backend/baton/src/main/java/touch/baton/domain/runner/exception/OldRunnerException.java b/backend/baton/src/main/java/touch/baton/domain/runner/exception/OldRunnerException.java deleted file mode 100644 index 800325968..000000000 --- a/backend/baton/src/main/java/touch/baton/domain/runner/exception/OldRunnerException.java +++ /dev/null @@ -1,22 +0,0 @@ -package touch.baton.domain.runner.exception; - -public class OldRunnerException extends RuntimeException { - - public OldRunnerException(final String message) { - super(message); - } - - public static class NotNull extends OldRunnerException { - - public NotNull(final String message) { - super(message); - } - } - - public static class NotFound extends OldRunnerException { - - public NotFound(final String message) { - super(message); - } - } -} diff --git a/backend/baton/src/main/java/touch/baton/domain/runner/exception/RunnerDomainException.java b/backend/baton/src/main/java/touch/baton/domain/runner/exception/RunnerDomainException.java index 72c817064..785f80016 100644 --- a/backend/baton/src/main/java/touch/baton/domain/runner/exception/RunnerDomainException.java +++ b/backend/baton/src/main/java/touch/baton/domain/runner/exception/RunnerDomainException.java @@ -6,6 +6,5 @@ public class RunnerDomainException extends DomainException { public RunnerDomainException(final String message) { super(message); - } } diff --git a/backend/baton/src/main/java/touch/baton/domain/runner/service/RunnerService.java b/backend/baton/src/main/java/touch/baton/domain/runner/service/RunnerService.java index d1fa565bb..8b288de3f 100644 --- a/backend/baton/src/main/java/touch/baton/domain/runner/service/RunnerService.java +++ b/backend/baton/src/main/java/touch/baton/domain/runner/service/RunnerService.java @@ -4,7 +4,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import touch.baton.domain.runner.Runner; -import touch.baton.domain.runner.exception.OldRunnerException; +import touch.baton.domain.runner.exception.RunnerDomainException; import touch.baton.domain.runner.repository.RunnerRepository; @RequiredArgsConstructor @@ -16,6 +16,6 @@ public class RunnerService { public Runner readRunnerWithMember(final Long runnerId) { return runnerRepository.joinMemberByRunnerId(runnerId) - .orElseThrow(() -> new OldRunnerException.NotFound("해당하는 식별자의 Runner 를 찾을 수 없습니다.")); + .orElseThrow(() -> new RunnerDomainException("해당하는 식별자의 Runner 를 찾을 수 없습니다. 식별자를 다시 확인해주세요.")); } } diff --git a/backend/baton/src/main/java/touch/baton/domain/runnerpost/RunnerPost.java b/backend/baton/src/main/java/touch/baton/domain/runnerpost/RunnerPost.java index 1b5e39d21..7f3cbfa97 100644 --- a/backend/baton/src/main/java/touch/baton/domain/runnerpost/RunnerPost.java +++ b/backend/baton/src/main/java/touch/baton/domain/runnerpost/RunnerPost.java @@ -18,7 +18,7 @@ import touch.baton.domain.common.vo.Title; import touch.baton.domain.common.vo.WatchedCount; import touch.baton.domain.runner.Runner; -import touch.baton.domain.runnerpost.exception.OldRunnerPostException; +import touch.baton.domain.runnerpost.exception.RunnerPostDomainException; import touch.baton.domain.runnerpost.vo.Deadline; import touch.baton.domain.runnerpost.vo.PullRequestUrl; import touch.baton.domain.runnerpost.vo.ReviewStatus; @@ -130,39 +130,39 @@ private void validateNotNull(final Title title, final RunnerPostTags runnerPostTags ) { if (Objects.isNull(title)) { - throw new OldRunnerPostException.NotNull("title 는 null 일 수 없습니다."); + throw new RunnerPostDomainException("RunnerPost 의 title 은 null 일 수 없습니다."); } if (Objects.isNull(contents)) { - throw new OldRunnerPostException.NotNull("contents 는 null 일 수 없습니다."); + throw new RunnerPostDomainException("RunnerPost 의 contents 는 null 일 수 없습니다."); } if (Objects.isNull(pullRequestUrl)) { - throw new OldRunnerPostException.NotNull("pullRequestUrl 는 null 일 수 없습니다."); + throw new RunnerPostDomainException("RunnerPost 의 pullRequestUrl 은 null 일 수 없습니다."); } if (Objects.isNull(deadline)) { - throw new OldRunnerPostException.NotNull("deadline 는 null 일 수 없습니다."); + throw new RunnerPostDomainException("RunnerPost 의 deadline 은 null 일 수 없습니다."); } if (Objects.isNull(watchedCount)) { - throw new OldRunnerPostException.NotNull("watchedCount 는 null 일 수 없습니다."); + throw new RunnerPostDomainException("RunnerPost 의 watchedCount 는 null 일 수 없습니다."); } if (Objects.isNull(chattingCount)) { - throw new OldRunnerPostException.NotNull("chattingCount 는 null 일 수 없습니다."); + throw new RunnerPostDomainException("RunnerPost 의 chattingCount 는 null 일 수 없습니다."); } if (Objects.isNull(reviewStatus)) { - throw new OldRunnerPostException.NotNull("reviewStatus 는 null 일 수 없습니다."); + throw new RunnerPostDomainException("RunnerPost 의 reviewStatus 는 null 일 수 없습니다."); } if (Objects.isNull(runner)) { - throw new OldRunnerPostException.NotNull("runner 는 null 일 수 없습니다."); + throw new RunnerPostDomainException("RunnerPost 의 runner 는 null 일 수 없습니다."); } if (Objects.isNull(runnerPostTags)) { - throw new OldRunnerPostException.NotNull("runnerPostTags 는 null 일 수 없습니다."); + throw new RunnerPostDomainException("RunnerPost 의 runnerPostTags 는 null 일 수 없습니다."); } } diff --git a/backend/baton/src/main/java/touch/baton/domain/runnerpost/exception/OldRunnerPostBusinessException.java b/backend/baton/src/main/java/touch/baton/domain/runnerpost/exception/OldRunnerPostBusinessException.java deleted file mode 100644 index 814fd2151..000000000 --- a/backend/baton/src/main/java/touch/baton/domain/runnerpost/exception/OldRunnerPostBusinessException.java +++ /dev/null @@ -1,17 +0,0 @@ -package touch.baton.domain.runnerpost.exception; - -import touch.baton.domain.runner.exception.OldRunnerException; - -public class OldRunnerPostBusinessException extends OldRunnerException { - - public OldRunnerPostBusinessException(final String message) { - super(message); - } - - public static class NotFound extends OldRunnerPostBusinessException { - - public NotFound(final String message) { - super(message); - } - } -} diff --git a/backend/baton/src/main/java/touch/baton/domain/runnerpost/exception/OldRunnerPostException.java b/backend/baton/src/main/java/touch/baton/domain/runnerpost/exception/OldRunnerPostException.java deleted file mode 100644 index 0a6ad3908..000000000 --- a/backend/baton/src/main/java/touch/baton/domain/runnerpost/exception/OldRunnerPostException.java +++ /dev/null @@ -1,15 +0,0 @@ -package touch.baton.domain.runnerpost.exception; - -public class OldRunnerPostException extends RuntimeException { - - public OldRunnerPostException(final String message) { - super(message); - } - - public static class NotNull extends OldRunnerPostException { - - public NotNull(final String message) { - super(message); - } - } -} diff --git a/backend/baton/src/main/java/touch/baton/domain/runnerpost/service/RunnerPostService.java b/backend/baton/src/main/java/touch/baton/domain/runnerpost/service/RunnerPostService.java index 86fab704e..b78b48fc2 100644 --- a/backend/baton/src/main/java/touch/baton/domain/runnerpost/service/RunnerPostService.java +++ b/backend/baton/src/main/java/touch/baton/domain/runnerpost/service/RunnerPostService.java @@ -8,7 +8,7 @@ import touch.baton.domain.common.vo.Title; import touch.baton.domain.runner.Runner; import touch.baton.domain.runnerpost.RunnerPost; -import touch.baton.domain.runnerpost.exception.OldRunnerPostBusinessException; +import touch.baton.domain.runnerpost.exception.RunnerPostBusinessException; import touch.baton.domain.runnerpost.repository.RunnerPostRepository; import touch.baton.domain.runnerpost.service.dto.RunnerPostCreateRequest; import touch.baton.domain.runnerpost.service.dto.RunnerPostCreateTestRequest; @@ -16,7 +16,6 @@ import touch.baton.domain.runnerpost.vo.Deadline; import touch.baton.domain.runnerpost.vo.PullRequestUrl; import touch.baton.domain.supporter.Supporter; -import touch.baton.domain.supporter.exception.OldSupporterException; import touch.baton.domain.supporter.repository.SupporterRepository; import touch.baton.domain.tag.RunnerPostTag; import touch.baton.domain.tag.Tag; @@ -61,8 +60,7 @@ public Long createRunnerPost(final Runner runner, final RunnerPostCreateRequest final List postTags = toSaveTags.stream() .map(tag -> RunnerPostTag.builder() .tag(tag) - .runnerPost(runnerPost) - .build()) + .runnerPost(runnerPost).build()) .toList(); runnerPost.addAllRunnerPostTags(postTags); @@ -87,7 +85,7 @@ public Long createRunnerPostTest(final Runner runner, final RunnerPostCreateTest if (Objects.nonNull(request.supporterId())) { final Supporter supporter = supporterRepository.findById(request.supporterId()) - .orElseThrow(() -> new OldSupporterException.NotNull("서포터가 존재하지 않습니다.")); + .orElseThrow(() -> new RunnerPostBusinessException("RunnerPost 의 서포터가 존재하지 않습니다.")); runnerPost.assignSupporter(supporter); } @@ -121,8 +119,7 @@ public Long createRunnerPostTest(final Runner runner, final RunnerPostCreateTest public RunnerPost readByRunnerPostId(final Long runnerPostId) { runnerPostTagRepository.joinTagByRunnerPostId(runnerPostId); - final RunnerPost findRunnerPost = runnerPostRepository.joinMemberByRunnerPostId(runnerPostId) - .orElseThrow(() -> new OldRunnerPostBusinessException.NotFound("러너 게시글 식별자값으로 러너 게시글을 조회할 수 없습니다.")); + final RunnerPost findRunnerPost = runnerPostRepository.joinMemberByRunnerPostId(runnerPostId).orElseThrow(() -> new RunnerPostBusinessException("RunnerPost 의 식별자값으로 러너 게시글을 조회할 수 없습니다.")); findRunnerPost.increaseWatchedCount(); @@ -133,7 +130,7 @@ public RunnerPost readByRunnerPostId(final Long runnerPostId) { public void deleteByRunnerPostId(final Long runnerPostId) { final Optional maybeRunnerPost = runnerPostRepository.findById(runnerPostId); if (maybeRunnerPost.isEmpty()) { - throw new OldRunnerPostBusinessException.NotFound("러너 게시글 식별자값으로 삭제할 러너 게시글이 존재하지 않습니다."); + throw new RunnerPostBusinessException("RunnerPost 의 식별자값으로 삭제할 러너 게시글이 존재하지 않습니다."); } runnerPostTagRepository.joinTagByRunnerPostId(runnerPostId) @@ -148,14 +145,13 @@ public void deleteByRunnerPostId(final Long runnerPostId) { public Long updateRunnerPost(final Long runnerPostId, final RunnerPostUpdateRequest request) { // TODO: 메소드 분리 final RunnerPost runnerPost = runnerPostRepository.findById(runnerPostId) - .orElseThrow(() -> new IllegalArgumentException("잘못된 runnerPostId 입니다.")); + .orElseThrow(() -> new IllegalArgumentException("해당 runnerPostId 로 러너 게시글을 찾을 수 없습니다. runnerPostId를 다시 확인해주세요")); runnerPost.updateTitle(new Title(request.title())); runnerPost.updateContents(new Contents(request.contents())); runnerPost.updatePullRequestUrl(new PullRequestUrl(request.pullRequestUrl())); runnerPost.updateDeadLine(new Deadline(request.deadline())); - final List presentRunnerPostTags = - runnerPostTagRepository.joinTagByRunnerPostId(runnerPost.getId()); + final List presentRunnerPostTags = runnerPostTagRepository.joinTagByRunnerPostId(runnerPost.getId()); // TODO: tag 개수 차감 메소드 분리 final List presentTags = presentRunnerPostTags.stream() .map(RunnerPostTag::getTag) diff --git a/backend/baton/src/main/java/touch/baton/domain/supporter/Supporter.java b/backend/baton/src/main/java/touch/baton/domain/supporter/Supporter.java index f0432ce64..d3ef38697 100644 --- a/backend/baton/src/main/java/touch/baton/domain/supporter/Supporter.java +++ b/backend/baton/src/main/java/touch/baton/domain/supporter/Supporter.java @@ -17,7 +17,7 @@ import touch.baton.domain.common.vo.Introduction; import touch.baton.domain.common.vo.TotalRating; import touch.baton.domain.member.Member; -import touch.baton.domain.supporter.exception.OldSupporterException; +import touch.baton.domain.supporter.exception.SupporterDomainException; import touch.baton.domain.supporter.vo.ReviewCount; import touch.baton.domain.supporter.vo.StarCount; import touch.baton.domain.technicaltag.SupporterTechnicalTag; @@ -103,27 +103,27 @@ private void validateNotNull(final ReviewCount reviewCount, final SupporterTechnicalTags supporterTechnicalTags ) { if (Objects.isNull(reviewCount)) { - throw new OldSupporterException.NotNull("reviewCount 는 null 일 수 없습니다."); + throw new SupporterDomainException("Supporter 의 reviewCount 는 null 일 수 없습니다."); } if (Objects.isNull(starCount)) { - throw new OldSupporterException.NotNull("starCount 는 null 일 수 없습니다."); + throw new SupporterDomainException("Supporter 의 starCount 는 null 일 수 없습니다."); } if (Objects.isNull(totalRating)) { - throw new OldSupporterException.NotNull("totalRating 은 null 일 수 없습니다."); + throw new SupporterDomainException("Supporter 의 totalRating 은 null 일 수 없습니다."); } if (Objects.isNull(grade)) { - throw new OldSupporterException.NotNull("grade 는 null 일 수 없습니다."); + throw new SupporterDomainException("Supporter 의 grade 는 null 일 수 없습니다."); } if (Objects.isNull(member)) { - throw new OldSupporterException.NotNull("member 는 null 일 수 없습니다."); + throw new SupporterDomainException("Supporter 의 member 는 null 일 수 없습니다."); } if (Objects.isNull(supporterTechnicalTags)) { - throw new OldSupporterException.NotNull("supporterTechnicalTags 는 null 일 수 없습니다."); + throw new SupporterDomainException("Supporter 의 supporterTechnicalTags 는 null 일 수 없습니다."); } } diff --git a/backend/baton/src/main/java/touch/baton/domain/supporter/exception/OldSupporterException.java b/backend/baton/src/main/java/touch/baton/domain/supporter/exception/OldSupporterException.java deleted file mode 100644 index af9897ad8..000000000 --- a/backend/baton/src/main/java/touch/baton/domain/supporter/exception/OldSupporterException.java +++ /dev/null @@ -1,15 +0,0 @@ -package touch.baton.domain.supporter.exception; - -public class OldSupporterException extends RuntimeException { - - public OldSupporterException(final String message) { - super(message); - } - - public static class NotNull extends OldSupporterException { - - public NotNull(final String message) { - super(message); - } - } -} diff --git a/backend/baton/src/main/java/touch/baton/domain/tag/RunnerPostTag.java b/backend/baton/src/main/java/touch/baton/domain/tag/RunnerPostTag.java index 54c91c1ff..2c0c6d8af 100644 --- a/backend/baton/src/main/java/touch/baton/domain/tag/RunnerPostTag.java +++ b/backend/baton/src/main/java/touch/baton/domain/tag/RunnerPostTag.java @@ -10,7 +10,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import touch.baton.domain.runnerpost.RunnerPost; -import touch.baton.domain.tag.exception.OldTagException; +import touch.baton.domain.tag.exception.RunnerPostTagDomainException; import java.util.Objects; @@ -51,11 +51,11 @@ private RunnerPostTag(final Long id, final RunnerPost runnerPost, final Tag tag) private void validateNotNull(final RunnerPost runnerPost, final Tag tag) { if (Objects.isNull(runnerPost)) { - throw new OldTagException.NotNull("runnerPost 은 null 일 수 없습니다."); + throw new RunnerPostTagDomainException("RunnerPostTag 의 runnerPost 는 null 일 수 없습니다."); } if (Objects.isNull(tag)) { - throw new OldTagException.NotNull("tag 은 null 일 수 없습니다."); + throw new RunnerPostTagDomainException("RunnerPostTag 의 tag 는 null 일 수 없습니다."); } } diff --git a/backend/baton/src/main/java/touch/baton/domain/tag/Tag.java b/backend/baton/src/main/java/touch/baton/domain/tag/Tag.java index fed713660..f0ba9581b 100644 --- a/backend/baton/src/main/java/touch/baton/domain/tag/Tag.java +++ b/backend/baton/src/main/java/touch/baton/domain/tag/Tag.java @@ -8,7 +8,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import touch.baton.domain.common.vo.TagName; -import touch.baton.domain.tag.exception.OldTagException; +import touch.baton.domain.tag.exception.TagDomainException; import touch.baton.domain.tag.vo.TagCount; import java.util.Objects; @@ -45,11 +45,11 @@ private Tag(final Long id, final TagName tagName, final TagCount tagCount) { private void validateNotNull(final TagName tagName, final TagCount tagCount) { if (Objects.isNull(tagName)) { - throw new OldTagException.NotNull("tagName 은 null 일 수 없습니다."); + throw new TagDomainException("Tag 의 tagName 은 null 일 수 없습니다."); } if (Objects.isNull(tagCount)) { - throw new OldTagException.NotNull("tagCount 은 null 일 수 없습니다."); + throw new TagDomainException("Tag 의 tagCount 는 null 일 수 없습니다."); } } diff --git a/backend/baton/src/main/java/touch/baton/domain/tag/exception/OldTagException.java b/backend/baton/src/main/java/touch/baton/domain/tag/exception/OldTagException.java deleted file mode 100644 index c14a49fa0..000000000 --- a/backend/baton/src/main/java/touch/baton/domain/tag/exception/OldTagException.java +++ /dev/null @@ -1,15 +0,0 @@ -package touch.baton.domain.tag.exception; - -public class OldTagException extends RuntimeException { - - public OldTagException(final String message) { - super(message); - } - - public static class NotNull extends OldTagException { - - public NotNull(final String message) { - super(message); - } - } -} diff --git a/backend/baton/src/main/java/touch/baton/domain/tag/exception/RunnerPostTagDomainException.java b/backend/baton/src/main/java/touch/baton/domain/tag/exception/RunnerPostTagDomainException.java new file mode 100644 index 000000000..88f24ecd1 --- /dev/null +++ b/backend/baton/src/main/java/touch/baton/domain/tag/exception/RunnerPostTagDomainException.java @@ -0,0 +1,10 @@ +package touch.baton.domain.tag.exception; + +import touch.baton.domain.common.exception.DomainException; + +public class RunnerPostTagDomainException extends DomainException { + + public RunnerPostTagDomainException(final String message) { + super(message); + } +} diff --git a/backend/baton/src/main/java/touch/baton/domain/tag/exception/SupporterTechnicalTagDomainException.java b/backend/baton/src/main/java/touch/baton/domain/tag/exception/SupporterTechnicalTagDomainException.java new file mode 100644 index 000000000..0acbe7fb7 --- /dev/null +++ b/backend/baton/src/main/java/touch/baton/domain/tag/exception/SupporterTechnicalTagDomainException.java @@ -0,0 +1,10 @@ +package touch.baton.domain.tag.exception; + +import touch.baton.domain.common.exception.DomainException; + +public class SupporterTechnicalTagDomainException extends DomainException { + + public SupporterTechnicalTagDomainException(final String message) { + super(message); + } +} diff --git a/backend/baton/src/main/java/touch/baton/domain/tag/exception/TechnicalTagDomainException.java b/backend/baton/src/main/java/touch/baton/domain/tag/exception/TechnicalTagDomainException.java new file mode 100644 index 000000000..2c9c0d285 --- /dev/null +++ b/backend/baton/src/main/java/touch/baton/domain/tag/exception/TechnicalTagDomainException.java @@ -0,0 +1,10 @@ +package touch.baton.domain.tag.exception; + +import touch.baton.domain.common.exception.DomainException; + +public class TechnicalTagDomainException extends DomainException { + + public TechnicalTagDomainException(final String message) { + super(message); + } +} diff --git a/backend/baton/src/main/java/touch/baton/domain/technicaltag/SupporterTechnicalTag.java b/backend/baton/src/main/java/touch/baton/domain/technicaltag/SupporterTechnicalTag.java index 12568aebd..ec8454234 100644 --- a/backend/baton/src/main/java/touch/baton/domain/technicaltag/SupporterTechnicalTag.java +++ b/backend/baton/src/main/java/touch/baton/domain/technicaltag/SupporterTechnicalTag.java @@ -10,7 +10,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import touch.baton.domain.supporter.Supporter; -import touch.baton.domain.tag.exception.OldTagException; +import touch.baton.domain.tag.exception.SupporterTechnicalTagDomainException; import java.util.Objects; @@ -53,11 +53,11 @@ private SupporterTechnicalTag(final Long id, final Supporter supporter, final Te private void validateNotNull(final Supporter supporter, final TechnicalTag technicalTag) { if (Objects.isNull(supporter)) { - throw new OldTagException.NotNull("supporter 는 null 일 수 없습니다."); + throw new SupporterTechnicalTagDomainException("SupporterTechnicalTag 의 supporter 는 null 일 수 없습니다."); } if (Objects.isNull(technicalTag)) { - throw new OldTagException.NotNull("technicalTag 는 null 일 수 없습니다."); + throw new SupporterTechnicalTagDomainException("SupporterTechnicalTag 의 technicalTag 는 null 일 수 없습니다."); } } } diff --git a/backend/baton/src/main/java/touch/baton/domain/technicaltag/TechnicalTag.java b/backend/baton/src/main/java/touch/baton/domain/technicaltag/TechnicalTag.java index 3daa9794e..cffffce11 100644 --- a/backend/baton/src/main/java/touch/baton/domain/technicaltag/TechnicalTag.java +++ b/backend/baton/src/main/java/touch/baton/domain/technicaltag/TechnicalTag.java @@ -8,7 +8,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import touch.baton.domain.common.vo.TagName; -import touch.baton.domain.tag.exception.OldTagException; +import touch.baton.domain.tag.exception.TechnicalTagDomainException; import java.util.Objects; @@ -40,7 +40,7 @@ private TechnicalTag(final Long id, final TagName tagName) { private void validateNotNull(final TagName tagName) { if (Objects.isNull(tagName)) { - throw new OldTagException.NotNull("tagName 은 null 일 수 없습니다."); + throw new TechnicalTagDomainException("TechnicalTag 의 tagName 은 null 일 수 없습니다."); } } } diff --git a/backend/baton/src/test/java/touch/baton/domain/runner/RunnerTest.java b/backend/baton/src/test/java/touch/baton/domain/runner/RunnerTest.java index 2cd1265f3..03dbca75a 100644 --- a/backend/baton/src/test/java/touch/baton/domain/runner/RunnerTest.java +++ b/backend/baton/src/test/java/touch/baton/domain/runner/RunnerTest.java @@ -12,7 +12,7 @@ import touch.baton.domain.member.vo.ImageUrl; import touch.baton.domain.member.vo.MemberName; import touch.baton.domain.member.vo.OauthId; -import touch.baton.domain.runner.exception.OldRunnerException; +import touch.baton.domain.runner.exception.RunnerDomainException; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -51,7 +51,8 @@ void fail_if_totalRating_is_null() { .grade(Grade.BARE_FOOT) .member(member) .build() - ).isInstanceOf(OldRunnerException.NotNull.class); + ).isInstanceOf(RunnerDomainException.class) + .hasMessage("Runner 의 totalRating 은 null 일 수 없습니다."); } @DisplayName("grade 가 null 이 들어갈 경우 예외가 발생한다.") @@ -62,7 +63,8 @@ void fail_if_grade_is_null() { .grade(null) .member(member) .build() - ).isInstanceOf(OldRunnerException.NotNull.class); + ).isInstanceOf(RunnerDomainException.class) + .hasMessage("Runner 의 grade 는 null 일 수 없습니다."); } @DisplayName("member 가 null 이 들어갈 경우 예외가 발생한다.") @@ -73,7 +75,8 @@ void fail_if_member_is_null() { .grade(Grade.BARE_FOOT) .member(null) .build() - ).isInstanceOf(OldRunnerException.NotNull.class); + ).isInstanceOf(RunnerDomainException.class) + .hasMessage("Runner 의 member 는 null 일 수 없습니다."); } } } diff --git a/backend/baton/src/test/java/touch/baton/domain/runner/service/RunnerServiceReadTest.java b/backend/baton/src/test/java/touch/baton/domain/runner/service/RunnerServiceReadTest.java index cb2936612..5b532395a 100644 --- a/backend/baton/src/test/java/touch/baton/domain/runner/service/RunnerServiceReadTest.java +++ b/backend/baton/src/test/java/touch/baton/domain/runner/service/RunnerServiceReadTest.java @@ -18,7 +18,7 @@ import touch.baton.domain.member.vo.MemberName; import touch.baton.domain.member.vo.OauthId; import touch.baton.domain.runner.Runner; -import touch.baton.domain.runner.exception.OldRunnerException; +import touch.baton.domain.runner.exception.RunnerDomainException; import touch.baton.domain.runner.repository.RunnerRepository; import static org.assertj.core.api.Assertions.assertThat; @@ -83,6 +83,6 @@ void success_readRunnerWithMember() { void fail_readRunnerWithMember_if_id_is_invalid() { // when, then assertThatThrownBy(() -> runnerService.readRunnerWithMember(999L)) - .isInstanceOf(OldRunnerException.NotFound.class); + .isInstanceOf(RunnerDomainException.class); } } diff --git a/backend/baton/src/test/java/touch/baton/domain/runnerpost/RunnerPostTest.java b/backend/baton/src/test/java/touch/baton/domain/runnerpost/RunnerPostTest.java index a31de36f2..be975ef88 100644 --- a/backend/baton/src/test/java/touch/baton/domain/runnerpost/RunnerPostTest.java +++ b/backend/baton/src/test/java/touch/baton/domain/runnerpost/RunnerPostTest.java @@ -17,7 +17,7 @@ import touch.baton.domain.member.vo.MemberName; import touch.baton.domain.member.vo.OauthId; import touch.baton.domain.runner.Runner; -import touch.baton.domain.runnerpost.exception.OldRunnerPostException; +import touch.baton.domain.runnerpost.exception.RunnerPostDomainException; import touch.baton.domain.runnerpost.vo.Deadline; import touch.baton.domain.runnerpost.vo.PullRequestUrl; import touch.baton.domain.runnerpost.vo.ReviewStatus; @@ -103,7 +103,7 @@ void success_if_supporter_is_null() { .deadline(new Deadline(LocalDateTime.now())) .watchedCount(new WatchedCount(0)) .chattingCount(new ChattingCount(0)) - .reviewStatus(ReviewStatus.NOT_STARTED ) + .reviewStatus(ReviewStatus.NOT_STARTED) .runner(runner) .supporter(null) .runnerPostTags(new RunnerPostTags(new ArrayList<>())) @@ -121,11 +121,13 @@ void fail_if_title_is_null() { .deadline(new Deadline(LocalDateTime.now())) .watchedCount(new WatchedCount(0)) .chattingCount(new ChattingCount(0)) + .reviewStatus(ReviewStatus.NOT_STARTED) .runner(runner) .supporter(supporter) .runnerPostTags(new RunnerPostTags(new ArrayList<>())) .build() - ).isInstanceOf(OldRunnerPostException.NotNull.class); + ).isInstanceOf(RunnerPostDomainException.class) + .hasMessage("RunnerPost 의 title 은 null 일 수 없습니다."); } @DisplayName("contents 에 null 이 들어갈 경우 예외가 발생한다.") @@ -138,11 +140,13 @@ void fail_if_contents_is_null() { .deadline(new Deadline(LocalDateTime.now())) .watchedCount(new WatchedCount(0)) .chattingCount(new ChattingCount(0)) + .reviewStatus(ReviewStatus.NOT_STARTED) .runner(runner) .supporter(supporter) .runnerPostTags(new RunnerPostTags(new ArrayList<>())) .build() - ).isInstanceOf(OldRunnerPostException.NotNull.class); + ).isInstanceOf(RunnerPostDomainException.class) + .hasMessage("RunnerPost 의 contents 는 null 일 수 없습니다."); } @DisplayName("pull request url 에 null 이 들어갈 경우 예외가 발생한다.") @@ -155,11 +159,13 @@ void fail_if_pullRequestUrl_is_null() { .deadline(new Deadline(LocalDateTime.now())) .watchedCount(new WatchedCount(0)) .chattingCount(new ChattingCount(0)) + .reviewStatus(ReviewStatus.NOT_STARTED) .runner(runner) .supporter(supporter) .runnerPostTags(new RunnerPostTags(new ArrayList<>())) .build() - ).isInstanceOf(OldRunnerPostException.NotNull.class); + ).isInstanceOf(RunnerPostDomainException.class) + .hasMessage("RunnerPost 의 pullRequestUrl 은 null 일 수 없습니다."); } @DisplayName("deadline 에 null 이 들어갈 경우 예외가 발생한다.") @@ -172,11 +178,13 @@ void fail_if_deadline_is_null() { .deadline(null) .watchedCount(new WatchedCount(0)) .chattingCount(new ChattingCount(0)) + .reviewStatus(ReviewStatus.NOT_STARTED) .runner(runner) .supporter(supporter) .runnerPostTags(new RunnerPostTags(new ArrayList<>())) .build() - ).isInstanceOf(OldRunnerPostException.NotNull.class); + ).isInstanceOf(RunnerPostDomainException.class) + .hasMessage("RunnerPost 의 deadline 은 null 일 수 없습니다."); } @DisplayName("watched count 에 null 이 들어갈 경우 예외가 발생한다.") @@ -189,11 +197,13 @@ void fail_if_watchedCount_is_null() { .deadline(new Deadline(LocalDateTime.now())) .watchedCount(null) .chattingCount(new ChattingCount(0)) + .reviewStatus(ReviewStatus.NOT_STARTED) .runner(runner) .supporter(supporter) .runnerPostTags(new RunnerPostTags(new ArrayList<>())) .build() - ).isInstanceOf(OldRunnerPostException.NotNull.class); + ).isInstanceOf(RunnerPostDomainException.class) + .hasMessage("RunnerPost 의 watchedCount 는 null 일 수 없습니다."); } @DisplayName("chatting room count 에 null 이 들어갈 경우 예외가 발생한다.") @@ -206,11 +216,13 @@ void fail_if_chattingRoomCount_is_null() { .deadline(new Deadline(LocalDateTime.now())) .watchedCount(new WatchedCount(0)) .chattingCount(null) + .reviewStatus(ReviewStatus.NOT_STARTED) .runner(runner) .supporter(supporter) .runnerPostTags(new RunnerPostTags(new ArrayList<>())) .build() - ).isInstanceOf(OldRunnerPostException.NotNull.class); + ).isInstanceOf(RunnerPostDomainException.class) + .hasMessage("RunnerPost 의 chattingCount 는 null 일 수 없습니다."); } @DisplayName("runner 에 null 이 들어갈 경우 예외가 발생한다.") @@ -223,11 +235,13 @@ void fail_if_runner_is_null() { .deadline(new Deadline(LocalDateTime.now())) .watchedCount(new WatchedCount(0)) .chattingCount(new ChattingCount(0)) + .reviewStatus(ReviewStatus.NOT_STARTED) .runner(null) .supporter(supporter) .runnerPostTags(new RunnerPostTags(new ArrayList<>())) .build() - ).isInstanceOf(OldRunnerPostException.NotNull.class); + ).isInstanceOf(RunnerPostDomainException.class) + .hasMessage("RunnerPost 의 runner 는 null 일 수 없습니다."); } @DisplayName("runnerPostTags 에 null 이 들어갈 경우 예외가 발생한다.") @@ -240,11 +254,13 @@ void fail_if_runnerPostTags_is_null() { .deadline(new Deadline(LocalDateTime.now())) .watchedCount(new WatchedCount(0)) .chattingCount(new ChattingCount(0)) + .reviewStatus(ReviewStatus.NOT_STARTED) .runner(runner) .supporter(supporter) .runnerPostTags(null) .build() - ).isInstanceOf(OldRunnerPostException.NotNull.class); + ).isInstanceOf(RunnerPostDomainException.class) + .hasMessage("RunnerPost 의 runnerPostTags 는 null 일 수 없습니다."); } @DisplayName("태그, 조회수, 채팅수가 초기화된 RunnerPost 를 생성할 수 있다.") diff --git a/backend/baton/src/test/java/touch/baton/domain/runnerpost/service/RunnerPostServiceDeleteTest.java b/backend/baton/src/test/java/touch/baton/domain/runnerpost/service/RunnerPostServiceDeleteTest.java index 1d946ed0b..85f9ef025 100644 --- a/backend/baton/src/test/java/touch/baton/domain/runnerpost/service/RunnerPostServiceDeleteTest.java +++ b/backend/baton/src/test/java/touch/baton/domain/runnerpost/service/RunnerPostServiceDeleteTest.java @@ -20,7 +20,7 @@ import touch.baton.domain.member.vo.OauthId; import touch.baton.domain.runner.Runner; import touch.baton.domain.runnerpost.RunnerPost; -import touch.baton.domain.runnerpost.exception.OldRunnerPostBusinessException; +import touch.baton.domain.runnerpost.exception.RunnerPostBusinessException; import touch.baton.domain.runnerpost.vo.Deadline; import touch.baton.domain.runnerpost.vo.PullRequestUrl; import touch.baton.domain.tag.RunnerPostTag; @@ -93,13 +93,15 @@ void success_deleteByRunnerPostId() { // then assertThatThrownBy(() -> runnerPostService.readByRunnerPostId(saveRunnerPostId)) - .isInstanceOf(OldRunnerPostBusinessException.NotFound.class); + .isInstanceOf(RunnerPostBusinessException.class) + .hasMessage("RunnerPost 의 식별자값으로 러너 게시글을 조회할 수 없습니다."); } @DisplayName("RunnerPost 식별자값으로 존재하지 않는 RunnerPost 을 삭제 시도할 경우 예외가 발생한다.") @Test void fail_deleteByRunnerPostId_if_runnerPost_is_null() { assertThatThrownBy(() -> runnerPostService.readByRunnerPostId(0L)) - .isInstanceOf(OldRunnerPostBusinessException.NotFound.class); + .isInstanceOf(RunnerPostBusinessException.class) + .hasMessage("RunnerPost 의 식별자값으로 러너 게시글을 조회할 수 없습니다."); } } diff --git a/backend/baton/src/test/java/touch/baton/domain/runnerpost/service/RunnerPostServiceReadTest.java b/backend/baton/src/test/java/touch/baton/domain/runnerpost/service/RunnerPostServiceReadTest.java index 720693550..016904cca 100644 --- a/backend/baton/src/test/java/touch/baton/domain/runnerpost/service/RunnerPostServiceReadTest.java +++ b/backend/baton/src/test/java/touch/baton/domain/runnerpost/service/RunnerPostServiceReadTest.java @@ -20,7 +20,7 @@ import touch.baton.domain.member.vo.OauthId; import touch.baton.domain.runner.Runner; import touch.baton.domain.runnerpost.RunnerPost; -import touch.baton.domain.runnerpost.exception.OldRunnerPostBusinessException; +import touch.baton.domain.runnerpost.exception.RunnerPostBusinessException; import touch.baton.domain.runnerpost.vo.Deadline; import touch.baton.domain.runnerpost.vo.PullRequestUrl; import touch.baton.domain.runnerpost.vo.ReviewStatus; @@ -107,6 +107,7 @@ void success_findByRunnerPostId() { @Test void fail_findByRunnerPostId_if_runner_post_is_null() { assertThatThrownBy(() -> runnerPostService.readByRunnerPostId(0L)) - .isInstanceOf(OldRunnerPostBusinessException.NotFound.class); + .isInstanceOf(RunnerPostBusinessException.class) + .hasMessage("RunnerPost 의 식별자값으로 러너 게시글을 조회할 수 없습니다."); } } diff --git a/backend/baton/src/test/java/touch/baton/domain/supporter/SupporterTest.java b/backend/baton/src/test/java/touch/baton/domain/supporter/SupporterTest.java index c6513ec23..f9d46f32d 100644 --- a/backend/baton/src/test/java/touch/baton/domain/supporter/SupporterTest.java +++ b/backend/baton/src/test/java/touch/baton/domain/supporter/SupporterTest.java @@ -13,7 +13,7 @@ import touch.baton.domain.member.vo.ImageUrl; import touch.baton.domain.member.vo.MemberName; import touch.baton.domain.member.vo.OauthId; -import touch.baton.domain.supporter.exception.OldSupporterException; +import touch.baton.domain.supporter.exception.SupporterDomainException; import touch.baton.domain.supporter.vo.ReviewCount; import touch.baton.domain.supporter.vo.StarCount; import touch.baton.domain.technicaltag.SupporterTechnicalTag; @@ -69,7 +69,8 @@ void fail_if_startCount_is_null() { .member(member) .supporterTechnicalTags(new SupporterTechnicalTags(new ArrayList<>())) .build() - ).isInstanceOf(OldSupporterException.NotNull.class); + ).isInstanceOf(SupporterDomainException.class) + .hasMessage("Supporter 의 starCount 는 null 일 수 없습니다."); } @DisplayName("totalRating 가 null 이 들어갈 경우 예외가 발생한다.") @@ -83,7 +84,8 @@ void fail_if_totalRating_is_null() { .member(member) .supporterTechnicalTags(new SupporterTechnicalTags(new ArrayList<>())) .build() - ).isInstanceOf(OldSupporterException.NotNull.class); + ).isInstanceOf(SupporterDomainException.class) + .hasMessage("Supporter 의 totalRating 은 null 일 수 없습니다."); } @DisplayName("grade 가 null 이 들어갈 경우 예외가 발생한다.") @@ -97,7 +99,8 @@ void fail_if_grade_is_null() { .member(member) .supporterTechnicalTags(new SupporterTechnicalTags(new ArrayList<>())) .build() - ).isInstanceOf(OldSupporterException.NotNull.class); + ).isInstanceOf(SupporterDomainException.class) + .hasMessage("Supporter 의 grade 는 null 일 수 없습니다."); } @DisplayName("member 가 null 이 들어갈 경우 예외가 발생한다.") @@ -111,7 +114,8 @@ void fail_if_member_is_null() { .member(null) .supporterTechnicalTags(new SupporterTechnicalTags(new ArrayList<>())) .build() - ).isInstanceOf(OldSupporterException.NotNull.class); + ).isInstanceOf(SupporterDomainException.class) + .hasMessage("Supporter 의 member 는 null 일 수 없습니다."); } @DisplayName("supporterTechnicalTags 가 null 이 들어갈 경우 예외가 발생한다.") @@ -125,7 +129,8 @@ void fail_if_supporterTechnicalTags_is_null() { .member(member) .supporterTechnicalTags(null) .build() - ).isInstanceOf(OldSupporterException.NotNull.class); + ).isInstanceOf(SupporterDomainException.class) + .hasMessage("Supporter 의 supporterTechnicalTags 는 null 일 수 없습니다."); } } diff --git a/backend/baton/src/test/java/touch/baton/domain/tag/RunnerPostTagTest.java b/backend/baton/src/test/java/touch/baton/domain/tag/RunnerPostTagTest.java index 02b162ff0..14ba127c1 100644 --- a/backend/baton/src/test/java/touch/baton/domain/tag/RunnerPostTagTest.java +++ b/backend/baton/src/test/java/touch/baton/domain/tag/RunnerPostTagTest.java @@ -25,7 +25,8 @@ import touch.baton.domain.supporter.Supporter; import touch.baton.domain.supporter.vo.ReviewCount; import touch.baton.domain.supporter.vo.StarCount; -import touch.baton.domain.tag.exception.OldTagException; +import touch.baton.domain.tag.exception.RunnerPostTagDomainException; +import touch.baton.domain.tag.exception.TagDomainException; import touch.baton.domain.tag.vo.TagCount; import touch.baton.domain.technicaltag.SupporterTechnicalTags; @@ -109,7 +110,8 @@ void fail_if_runnerPost_is_null() { .runnerPost(null) .tag(tag) .build() - ).isInstanceOf(OldTagException.NotNull.class); + ).isInstanceOf(RunnerPostTagDomainException.class) + .hasMessage("RunnerPostTag 의 runnerPost 는 null 일 수 없습니다."); } @DisplayName("tag 가 null 이 들어갈 경우 예외가 발생한다.") @@ -119,7 +121,8 @@ void fail_if_tag_is_null() { .runnerPost(runnerPost) .tag(null) .build() - ).isInstanceOf(OldTagException.NotNull.class); + ).isInstanceOf(RunnerPostTagDomainException.class) + .hasMessage("RunnerPostTag 의 tag 는 null 일 수 없습니다."); } } } diff --git a/backend/baton/src/test/java/touch/baton/domain/tag/TagTest.java b/backend/baton/src/test/java/touch/baton/domain/tag/TagTest.java index 2498f7890..521959ac8 100644 --- a/backend/baton/src/test/java/touch/baton/domain/tag/TagTest.java +++ b/backend/baton/src/test/java/touch/baton/domain/tag/TagTest.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import touch.baton.domain.common.vo.TagName; -import touch.baton.domain.tag.exception.OldTagException; +import touch.baton.domain.tag.exception.TagDomainException; import touch.baton.domain.tag.vo.TagCount; import static org.assertj.core.api.Assertions.*; @@ -33,7 +33,8 @@ void fail_if_tagName_is_null() { .tagName(null) .tagCount(new TagCount(0)) .build() - ).isInstanceOf(OldTagException.NotNull.class); + ).isInstanceOf(TagDomainException.class) + .hasMessage("Tag 의 tagName 은 null 일 수 없습니다."); } @DisplayName("tag count 가 null 이 들어갈 경우 예외가 발생한다.") @@ -43,7 +44,8 @@ void fail_if_tagCount_is_null() { .tagName(new TagName("자바")) .tagCount(null) .build() - ).isInstanceOf(OldTagException.NotNull.class); + ).isInstanceOf(TagDomainException.class) + .hasMessage("Tag 의 tagCount 는 null 일 수 없습니다."); } } @@ -75,6 +77,5 @@ void increaseCount() { () -> assertThat(tag.getTagName()).isEqualTo(new TagName("Java")), () -> assertThat(tag.getTagCount()).isEqualTo(new TagCount(2)) ); - } } diff --git a/backend/baton/src/test/java/touch/baton/domain/technicaltag/SupporterTechnicalTagTest.java b/backend/baton/src/test/java/touch/baton/domain/technicaltag/SupporterTechnicalTagTest.java index 0fce45a08..103bfc0e4 100644 --- a/backend/baton/src/test/java/touch/baton/domain/technicaltag/SupporterTechnicalTagTest.java +++ b/backend/baton/src/test/java/touch/baton/domain/technicaltag/SupporterTechnicalTagTest.java @@ -9,7 +9,8 @@ import touch.baton.domain.supporter.Supporter; import touch.baton.domain.supporter.vo.ReviewCount; import touch.baton.domain.supporter.vo.StarCount; -import touch.baton.domain.tag.exception.OldTagException; +import touch.baton.domain.tag.exception.SupporterTechnicalTagDomainException; +import touch.baton.domain.tag.exception.TagDomainException; import touch.baton.fixture.domain.MemberFixture; import touch.baton.fixture.domain.SupporterFixture; import touch.baton.fixture.domain.TechnicalTagFixture; @@ -54,7 +55,8 @@ void fail_if_supporter_is_null() { .supporter(null) .technicalTag(technicalTag) .build() - ).isInstanceOf(OldTagException.NotNull.class); + ).isInstanceOf(SupporterTechnicalTagDomainException.class) + .hasMessage("SupporterTechnicalTag 의 supporter 는 null 일 수 없습니다."); } @DisplayName("technical tag 가 null 이 들어갈 경우 예외가 발생한다.") @@ -64,7 +66,8 @@ void fail_if_technical_tag_is_null() { .supporter(supporter) .technicalTag(null) .build() - ).isInstanceOf(OldTagException.NotNull.class); + ).isInstanceOf(SupporterTechnicalTagDomainException.class) + .hasMessage("SupporterTechnicalTag 의 technicalTag 는 null 일 수 없습니다."); } } } diff --git a/backend/baton/src/test/java/touch/baton/domain/technicaltag/TechnicalTagTest.java b/backend/baton/src/test/java/touch/baton/domain/technicaltag/TechnicalTagTest.java index 774e8f50c..049661453 100644 --- a/backend/baton/src/test/java/touch/baton/domain/technicaltag/TechnicalTagTest.java +++ b/backend/baton/src/test/java/touch/baton/domain/technicaltag/TechnicalTagTest.java @@ -3,7 +3,8 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import touch.baton.domain.common.vo.TagName; -import touch.baton.domain.tag.exception.OldTagException; +import touch.baton.domain.tag.exception.TagDomainException; +import touch.baton.domain.tag.exception.TechnicalTagDomainException; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -25,6 +26,7 @@ void fail_if_tagName_is_null() { assertThatThrownBy(() -> TechnicalTag.builder() .tagName(null) .build() - ).isInstanceOf(OldTagException.NotNull.class); + ).isInstanceOf(TechnicalTagDomainException.class) + .hasMessage("TechnicalTag 의 tagName 은 null 일 수 없습니다."); } }