From 092e12de8496c459a97f3efc4342ff86ffd992af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=90=ED=99=8D=EC=84=9D?= <78216059+bayy1216@users.noreply.github.com> Date: Sun, 21 Jul 2024 21:08:02 +0900 Subject: [PATCH] [Test]: Fix test error --- .../userchallenge/UserChallengeServiceTest.java | 9 ++++----- .../org/haedal/zzansuni/domain/user/UserServiceTest.java | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/zzansuni-api-server/app/src/test/java/org/haedal/zzansuni/domain/challengegroup/userchallenge/UserChallengeServiceTest.java b/zzansuni-api-server/app/src/test/java/org/haedal/zzansuni/domain/challengegroup/userchallenge/UserChallengeServiceTest.java index b0b40b0..a616b1a 100644 --- a/zzansuni-api-server/app/src/test/java/org/haedal/zzansuni/domain/challengegroup/userchallenge/UserChallengeServiceTest.java +++ b/zzansuni-api-server/app/src/test/java/org/haedal/zzansuni/domain/challengegroup/userchallenge/UserChallengeServiceTest.java @@ -7,6 +7,7 @@ import org.haedal.zzansuni.domain.challengegroup.DayType; import org.haedal.zzansuni.domain.challengegroup.challenge.*; import org.haedal.zzansuni.domain.challengegroup.challenge.port.ChallengeReader; +import org.haedal.zzansuni.domain.userchallenge.AddUserExpByVerificationUseCase; import org.haedal.zzansuni.domain.userchallenge.review.port.ChallengeReviewReader; import org.haedal.zzansuni.domain.userchallenge.UserChallenge; import org.haedal.zzansuni.domain.userchallenge.port.UserChallengeReader; @@ -60,6 +61,9 @@ class UserChallengeServiceTest { @Mock private ChallengeGroupUserExpStore challengeGroupUserExpStore; + @Mock + private AddUserExpByVerificationUseCase addUserExpByVerificationUseCase; + @InjectMocks private UserChallengeService userChallengeService; @@ -167,9 +171,6 @@ void verification() { when(userChallengeReader.getByChallengeIdWithVerificationAndChallenge(challengeId, userId)).thenReturn(userChallenge); - when(challengeGroupReader.findByChallengeGroupIdAndUserId(challengeGroup.getId(), - userId)).thenReturn(Optional.of(challengeGroupUserExp)); - ChallengeModel.ChallengeVerificationResult result = userChallengeService.verification( challengeId, userId, command); @@ -180,8 +181,6 @@ void verification() { verify(userChallengeReader).getByChallengeIdWithVerificationAndChallenge(challengeId, userId); - verify(challengeGroupReader).findByChallengeGroupIdAndUserId(challengeGroup.getId(), - userId); } @Test diff --git a/zzansuni-api-server/app/src/test/java/org/haedal/zzansuni/domain/user/UserServiceTest.java b/zzansuni-api-server/app/src/test/java/org/haedal/zzansuni/domain/user/UserServiceTest.java index 30df993..dfe52b3 100644 --- a/zzansuni-api-server/app/src/test/java/org/haedal/zzansuni/domain/user/UserServiceTest.java +++ b/zzansuni-api-server/app/src/test/java/org/haedal/zzansuni/domain/user/UserServiceTest.java @@ -22,7 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.when; -@SpringBootTest + @ExtendWith(MockitoExtension.class) public class UserServiceTest { @InjectMocks