Skip to content

Commit

Permalink
test: 실패하는 테스트 케이스 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingyum-Kim committed Jul 31, 2024
1 parent 8c2d30c commit 948a561
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ void findNickNamesByMoimId() {
.time(LocalTime.now().minusHours(1))
.place("서울시 강북구 중앙로 2길 25")
.maxPeople(10)
.authorNickname("안나")
.description("모임 설명입니다.")
.build();
Moim saveMoim = moimRepository.save(moim);
Expand Down
42 changes: 0 additions & 42 deletions backend/src/test/java/mouda/backend/moim/domain/MoimTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ void createMoim() {
.time(TIME)
.place(PLACE)
.maxPeople(MAX_PEOPLE)
.authorNickname(AUTHOR_NICKNAME)
.description(DESCRIPTION)
.build());
}
Expand All @@ -45,7 +44,6 @@ void failToCreateMoimWhenTitleIsTooLong() {
.time(TIME)
.place(PLACE)
.maxPeople(MAX_PEOPLE)
.authorNickname(AUTHOR_NICKNAME)
.description(DESCRIPTION)
.build());
}
Expand All @@ -59,7 +57,6 @@ void failToCreateMoimWhenTitleDoesNotExists() {
.time(TIME)
.place(PLACE)
.maxPeople(MAX_PEOPLE)
.authorNickname(AUTHOR_NICKNAME)
.description(DESCRIPTION)
.build());
}
Expand All @@ -73,7 +70,6 @@ void failToCreateMoimWhenDateIsNull() {
.time(TIME)
.place(PLACE)
.maxPeople(MAX_PEOPLE)
.authorNickname(AUTHOR_NICKNAME)
.description(DESCRIPTION)
.build());
}
Expand All @@ -87,7 +83,6 @@ void failToCreateMoimWhenTimeIsNull() {
.time(null)
.place(PLACE)
.maxPeople(MAX_PEOPLE)
.authorNickname(AUTHOR_NICKNAME)
.description(DESCRIPTION)
.build());
}
Expand All @@ -101,7 +96,6 @@ void failToCreateMoimWhenDateIsPast() {
.time(LocalTime.now().plusHours(1))
.place(PLACE)
.maxPeople(MAX_PEOPLE)
.authorNickname(AUTHOR_NICKNAME)
.description(DESCRIPTION)
.build());
}
Expand All @@ -115,7 +109,6 @@ void failToCreateMoimWhenTimeIsPast() {
.time(LocalTime.now().minusHours(1))
.place(PLACE)
.maxPeople(MAX_PEOPLE)
.authorNickname(AUTHOR_NICKNAME)
.description(DESCRIPTION)
.build());
}
Expand All @@ -129,7 +122,6 @@ void failToCreateMoimWhenPlaceIsBlank() {
.time(LocalTime.now().minusHours(1))
.place("")
.maxPeople(MAX_PEOPLE)
.authorNickname(AUTHOR_NICKNAME)
.description(DESCRIPTION)
.build());
}
Expand All @@ -144,7 +136,6 @@ void failToCreateMoimWhenPlaceIsTooLong() {
.time(TIME)
.place(longPlace)
.maxPeople(MAX_PEOPLE)
.authorNickname(AUTHOR_NICKNAME)
.description(DESCRIPTION)
.build());
}
Expand All @@ -158,7 +149,6 @@ void failToCreateMoimWhenMaxPeopleIsTooSmall() {
.time(TIME)
.place(PLACE)
.maxPeople(-1)
.authorNickname(AUTHOR_NICKNAME)
.description(DESCRIPTION)
.build());
}
Expand All @@ -172,36 +162,6 @@ void failToCreateMoimWhenMaxPeopleIsTooMany() {
.time(TIME)
.place(PLACE)
.maxPeople(100)
.authorNickname(AUTHOR_NICKNAME)
.description(DESCRIPTION)
.build());
}

@DisplayName("작성자 닉네임이 빈 문자열이면 모임 객체 생성에 실패한다.")
@Test
void failToCreateMoimWhenAuthorNicknameIsBlank() {
assertThrows(MoimException.class, () -> Moim.builder()
.title(TITLE)
.date(DATE)
.time(TIME)
.place(PLACE)
.maxPeople(MAX_PEOPLE)
.authorNickname("")
.description(DESCRIPTION)
.build());
}

@DisplayName("작성자 닉네임 길이가 제한을 초과하면 모임 객체 생성에 실패한다.")
@Test
void failToCreateMoimWhenAuthorNicknameIsTooLong() {
String longNickname = "a".repeat(11);
assertThrows(MoimException.class, () -> Moim.builder()
.title(TITLE)
.date(DATE)
.time(TIME)
.place(PLACE)
.maxPeople(MAX_PEOPLE)
.authorNickname(longNickname)
.description(DESCRIPTION)
.build());
}
Expand All @@ -215,7 +175,6 @@ void createMoimWhenDescriptionIsNull() {
.time(TIME)
.place(PLACE)
.maxPeople(MAX_PEOPLE)
.authorNickname(AUTHOR_NICKNAME)
.description(null)
.build());
}
Expand All @@ -230,7 +189,6 @@ void failToCreateMoimWhenDescriptionIsTooLong() {
.time(TIME)
.place(PLACE)
.maxPeople(MAX_PEOPLE)
.authorNickname(AUTHOR_NICKNAME)
.description(longDescription)
.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void deleteMoim() {
@Test
void failToJoinMoimWhenExceedMaxPeople() {
MoimCreateRequest moimCreateRequest = new MoimCreateRequest(
"title", LocalDate.now(), LocalTime.now(), "place",
"title", LocalDate.now().plusDays(1), LocalTime.now(), "place",
2, "안나", "설명"
);

Expand Down

0 comments on commit 948a561

Please sign in to comment.