Skip to content

Commit

Permalink
test: 테스트 데이터 관련 메소드 추가 (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
choidongkuen committed Feb 16, 2024
1 parent 7ec6b2e commit d3c44a9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/test/java/net/teumteum/integration/Repository.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


import java.util.List;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import lombok.RequiredArgsConstructor;
import net.teumteum.core.config.AppConfig;
Expand Down Expand Up @@ -139,6 +138,11 @@ List<Meeting> saveAndGetCloseMeetingsByParticipantUserId(int size, Long particip
return meetingRepository.saveAllAndFlush(meetings);
}

Meeting saveAndGetCloseMeetingByParticipantUserIds(List<Long> participantUserIds) {
var meeting = MeetingFixture.getCloseMeetingWithParticipantIds(participantUserIds);
return meetingRepository.save(meeting);
}

List<Meeting> saveAndGetOpenMeetings(int size) {
var meetings = Stream.generate(MeetingFixture::getOpenMeeting)
.limit(size)
Expand Down
31 changes: 31 additions & 0 deletions src/test/java/net/teumteum/meeting/domain/MeetingFixture.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,44 @@ public static Meeting getOpenMeeting() {
);
}

public static Meeting getOpenMeetingWithId(Long meetingId) {
return newMeetingByBuilder(MeetingBuilder.builder()
.id(meetingId)
.promiseDateTime(LocalDateTime.of(4000, 1, 1, 0, 0))
.build());

}

public static Meeting getCloseMeeting() {
return newMeetingByBuilder(MeetingBuilder.builder()
.promiseDateTime(LocalDateTime.of(2000, 1, 1, 0, 0))
.build()
);
}

public static Meeting getCloseMeetingWithId(Long meetingId) {
return newMeetingByBuilder(MeetingBuilder.builder()
.id(meetingId)
.promiseDateTime(LocalDateTime.of(2000, 1, 1, 0, 0))
.build());
}

public static Meeting getCloseMeetingWithIdAndParticipantIds(Long meetingId, List<Long> participantIds) {
return newMeetingByBuilder(MeetingBuilder.builder()
.id(meetingId)
.participantUserIds(new HashSet<>(participantIds))
.promiseDateTime(LocalDateTime.of(2000, 1, 1, 0, 0))
.build()
);
}

public static Meeting getCloseMeetingWithParticipantIds(List<Long> participantIds) {
return newMeetingByBuilder(MeetingBuilder.builder()
.participantUserIds(new HashSet<>(participantIds))
.promiseDateTime(LocalDateTime.of(2000, 1, 1, 0, 0))
.build());
}

public static Meeting getOpenFullMeeting() {
return newMeetingByBuilder(MeetingBuilder.builder()
.promiseDateTime(LocalDateTime.of(4000, 1, 1, 0, 0))
Expand Down

0 comments on commit d3c44a9

Please sign in to comment.