Skip to content

Commit

Permalink
test : score 타입 BigDecimal로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
KoSeonJe committed Aug 31, 2024
1 parent 5e43673 commit 0441ec3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,11 @@
import ddingdong.ddingdongBE.domain.scorehistory.entity.Score;
import ddingdong.ddingdongBE.domain.user.entity.User;
import ddingdong.ddingdongBE.domain.user.repository.UserRepository;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.math.BigDecimal;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;

@SpringBootTest
class FacadeClubMemberServiceTest extends TestContainerSupport {
Expand Down Expand Up @@ -117,7 +108,7 @@ void update() {
fixtureMonkey.giveMeBuilder(Club.class)
.set("user", savedUser)
.set("clubMembers", null)
.set("score", Score.from(0))
.set("score", Score.from(new BigDecimal(0)))
.sample());
ClubMember savedClubMember = clubMemberRepository.save(
fixtureMonkey.giveMeBuilder(ClubMember.class).set("club", savedClub).sample());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import ddingdong.ddingdongBE.domain.scorehistory.entity.ScoreHistory;
import ddingdong.ddingdongBE.common.support.WebApiUnitTestSupport;
import ddingdong.ddingdongBE.common.support.WithMockAuthenticatedUser;
import java.math.BigDecimal;
import java.util.List;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand All @@ -29,16 +30,16 @@ void findAllScoreHistories() throws Exception {
//given
Club club = Club.builder()
.id(1L)
.score(Score.from(55)).build();
.score(Score.from(new BigDecimal(55))).build();
List<ScoreHistory> scoreHistories = List.of(ScoreHistory.builder()
.club(club)
.scoreCategory(CARRYOVER_SCORE)
.amount(5)
.amount(new BigDecimal(5))
.reason("reasonA").build(),
ScoreHistory.builder()
.club(club)
.scoreCategory(ACTIVITY_REPORT)
.amount(5)
.amount(new BigDecimal(5))
.reason("reasonB").build());
when(clubService.getByClubId(anyLong())).thenReturn(club);
when(scoreHistoryService.findAllByClubId(club.getId())).thenReturn(scoreHistories);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import ddingdong.ddingdongBE.domain.scorehistory.entity.ScoreHistory;
import ddingdong.ddingdongBE.common.support.WebApiUnitTestSupport;
import ddingdong.ddingdongBE.common.support.WithMockAuthenticatedUser;
import java.math.BigDecimal;
import java.util.List;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand All @@ -29,16 +30,16 @@ void getScoreHistories() throws Exception {
//given
Club club = Club.builder()
.id(1L)
.score(Score.from(55)).build();
.score(Score.from(new BigDecimal(55))).build();
List<ScoreHistory> scoreHistories = List.of(ScoreHistory.builder()
.club(club)
.scoreCategory(CARRYOVER_SCORE)
.amount(5)
.amount(new BigDecimal(5))
.reason("reasonA").build(),
ScoreHistory.builder()
.club(club)
.scoreCategory(ACTIVITY_REPORT)
.amount(5)
.amount(new BigDecimal(5))
.reason("reasonB").build());
when(clubService.getByUserId(anyLong())).thenReturn(club);
when(scoreHistoryService.findAllByUserId(club.getId())).thenReturn(scoreHistories);
Expand Down

0 comments on commit 0441ec3

Please sign in to comment.