Skip to content

Commit

Permalink
test: 테스트 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
shkisme committed Oct 13, 2023
1 parent d99e622 commit 578e457
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class GetAttendanceTest {
public void 유효한_요청일_경우_오늘_출석_포인트_조회는_성공한다() throws Exception {
String securedValue = getSecuredValue(AttendanceController.class, "getTodayAttendancePoint");

attendanceTestHelper.builder().member(member).build();

mockMvc.perform(get("/attendances/point")
.cookie(new Cookie(ACCESS_TOKEN.getTokenName(), memberToken)))
.andExpect(status().isOk())
Expand All @@ -152,6 +154,8 @@ class GetAttendanceTest {
public void 유효한_요청일_경우_출석_정보_조회는_성공한다() throws Exception {
String securedValue = getSecuredValue(AttendanceController.class, "getAttendanceInfo");

attendanceTestHelper.builder().member(member).build();

mockMvc.perform(get("/attendances/members/{memberId}/info", member.getId())
.cookie(new Cookie(ACCESS_TOKEN.getTokenName(), memberToken)))
.andExpect(status().isOk())
Expand All @@ -177,6 +181,7 @@ class GetAttendanceTest {
public void 유효한_요청일_경우_출석_정보_목록_조회는_성공한다() throws Exception {
String securedValue = getSecuredValue(AttendanceController.class, "getTotalAttendance");

attendanceTestHelper.builder().member(member).build();
LocalDate now = LocalDate.now();

mockMvc.perform(get("/attendances/members/{memberId}/total", member.getId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AttendanceTest {
Optional<String> data = redisUtil.getData("attendance:" + now, String.class);

assertThat(data).isNotEmpty();
assertThat(data.get()).isEqualTo(String.valueOf(3));
assertThat(data.get()).isEqualTo(String.valueOf(2));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.keeper.homepage.IntegrationTest;
import com.keeper.homepage.domain.attendance.entity.Attendance;
import com.keeper.homepage.domain.member.entity.Member;
import java.lang.reflect.UndeclaredThrowableException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
Expand Down Expand Up @@ -46,7 +45,7 @@ void should_throwException_when_duplicateAttendance() {
.date(LocalDate.of(2022, 1, 24))
.member(member)
.build())
.isInstanceOf(UndeclaredThrowableException.class);
.isInstanceOf(Exception.class);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import com.keeper.homepage.IntegrationTest;
import com.keeper.homepage.domain.ctf.entity.CtfContest;
import java.lang.reflect.UndeclaredThrowableException;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
Expand All @@ -26,7 +25,7 @@ class DBTest {
.ctfContest(ctfContest)
.build();

assertThrows(UndeclaredThrowableException.class, () -> {
assertThrows(Exception.class, () -> {
ctfTeamTestHelper.builder()
.name(teamName)
.ctfContest(ctfContest)
Expand Down

0 comments on commit 578e457

Please sign in to comment.