Skip to content

Commit

Permalink
refactor: 현재 인원 조회 예외 메시지 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Arachneee committed Jul 24, 2024
1 parent da1bd59 commit 4d3c9e7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import server.haengdong.domain.action.MemberActionRepository;
import server.haengdong.domain.event.Event;
import server.haengdong.domain.event.EventRepository;
import server.haengdong.exception.HaengdongErrorCode;
import server.haengdong.exception.HaengdongException;

@RequiredArgsConstructor
@Transactional(readOnly = true)
Expand Down Expand Up @@ -53,6 +55,6 @@ public List<CurrentMemberAppResponse> getCurrentMembers(String token) {

private Event findEvent(String token) {
return eventRepository.findByToken(token)
.orElseThrow(() -> new IllegalArgumentException("event not found"));
.orElseThrow(() -> new HaengdongException(HaengdongErrorCode.NOT_FOUND_EVENT));
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package server.haengdong.presentation.request;

import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import server.haengdong.application.request.BillActionAppRequest;

public record BillActionSaveRequest(

@NotEmpty
@NotBlank
String title,

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import server.haengdong.domain.action.MemberActionRepository;
import server.haengdong.domain.event.Event;
import server.haengdong.domain.event.EventRepository;
import server.haengdong.exception.HaengdongException;

@SpringBootTest
class MemberActionServiceTest {
Expand Down Expand Up @@ -79,13 +80,13 @@ void saveMemberActionTest2() {
List.of(new MemberActionSaveAppRequest("TOKEN", "OUT")));

assertThatCode(() -> memberActionService.saveMemberAction("TOKEN", appRequest))
.isInstanceOf(IllegalArgumentException.class);
.isInstanceOf(HaengdongException.class);
}

@DisplayName("이벤트가 없으면 현재 참여 인원을 조회할 수 없다.")
@Test
void getCurrentMembers() {
assertThatThrownBy(() -> memberActionService.getCurrentMembers("token"))
.isInstanceOf(IllegalArgumentException.class);
.isInstanceOf(HaengdongException.class);
}
}

0 comments on commit 4d3c9e7

Please sign in to comment.