diff --git a/backend/src/main/java/corea/exception/ExceptionType.java b/backend/src/main/java/corea/exception/ExceptionType.java index 2131ded57..03f54e8a8 100644 --- a/backend/src/main/java/corea/exception/ExceptionType.java +++ b/backend/src/main/java/corea/exception/ExceptionType.java @@ -9,7 +9,6 @@ public enum ExceptionType { ALREADY_PARTICIPATED_ROOM(HttpStatus.BAD_REQUEST, "해당 방에 이미 참여했습니다."), NOT_PARTICIPATED_ROOM(HttpStatus.BAD_REQUEST, "아직 참여하지 않은 방입니다."), ROOM_STATUS_INVALID(HttpStatus.BAD_REQUEST, "방이 마감되었습니다."), - MEMBER_IS_NOT_MANAGER(HttpStatus.BAD_REQUEST, "매니저가 아닙니다."), ROOM_PARTICIPANT_EXCEED(HttpStatus.BAD_REQUEST, "방 참여 인원 수가 최대입니다."), PARTICIPANT_SIZE_LACK(HttpStatus.BAD_REQUEST, "참여 인원이 부족하여 매칭을 진행할 수 없습니다."), PARTICIPANT_SIZE_LACK_DUE_TO_PULL_REQUEST(HttpStatus.BAD_REQUEST, "pull request 미제출로 인해 인원이 부족하여 매칭을 진행할 수 없습니다."), @@ -26,7 +25,7 @@ public enum ExceptionType { TOKEN_EXPIRED(HttpStatus.UNAUTHORIZED, "토큰이 만료되었습니다."), INVALID_TOKEN(HttpStatus.UNAUTHORIZED, "토큰이 올바르지 않습니다."), AUTHORIZATION_ERROR(HttpStatus.UNAUTHORIZED, "인증에 실패했습니다."), - ROOM_DELETION_AUTHORIZATION_ERROR(HttpStatus.UNAUTHORIZED, "방 삭제 권한이 없습니다. 방 생성자만 방을 삭제할 수 있습니다."), + ROOM_MODIFY_AUTHORIZATION_ERROR(HttpStatus.UNAUTHORIZED, "방 정보 변경 권한이 없습니다. 방 생성자만 방 정보를 변경할 수 있습니다."), FEEDBACK_UPDATE_AUTHORIZATION_ERROR(HttpStatus.UNAUTHORIZED, "피드백 수정 권한이 없습니다. 피드백 작성자만 피드백을 수정할 수 있습니다."), MEMBER_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 멤버를 찾을 수 없습니다."), diff --git a/backend/src/main/java/corea/member/domain/MemberReader.java b/backend/src/main/java/corea/member/domain/MemberReader.java new file mode 100644 index 000000000..62749fa63 --- /dev/null +++ b/backend/src/main/java/corea/member/domain/MemberReader.java @@ -0,0 +1,21 @@ +package corea.member.domain; + +import corea.exception.CoreaException; +import corea.exception.ExceptionType; +import corea.member.repository.MemberRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Component +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class MemberReader { + + private final MemberRepository memberRepository; + + public Member findOne(long memberId) { + return memberRepository.findById(memberId) + .orElseThrow(() -> new CoreaException(ExceptionType.MEMBER_NOT_FOUND)); + } +} diff --git a/backend/src/main/java/corea/participation/domain/ParticipationReader.java b/backend/src/main/java/corea/participation/domain/ParticipationReader.java new file mode 100644 index 000000000..37dc2cae2 --- /dev/null +++ b/backend/src/main/java/corea/participation/domain/ParticipationReader.java @@ -0,0 +1,19 @@ +package corea.participation.domain; + +import corea.member.domain.MemberRole; +import corea.participation.repository.ParticipationRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class ParticipationReader { + + private final ParticipationRepository participationRepository; + + public MemberRole findMemberRole(long roomId, long memberId) { + return participationRepository.findByRoomIdAndMemberId(roomId, memberId) + .map(Participation::getMemberRole) + .orElse(MemberRole.NONE); + } +} diff --git a/backend/src/main/java/corea/participation/domain/ParticipationWriter.java b/backend/src/main/java/corea/participation/domain/ParticipationWriter.java index e06f17f42..142ce1719 100644 --- a/backend/src/main/java/corea/participation/domain/ParticipationWriter.java +++ b/backend/src/main/java/corea/participation/domain/ParticipationWriter.java @@ -20,7 +20,6 @@ public class ParticipationWriter { private final ParticipationRepository participationRepository; public Participation create(Room room, Member member, MemberRole memberRole, ParticipationStatus participationStatus) { - return create(room, member, memberRole, participationStatus, room.getMatchingSize()); } @@ -45,6 +44,13 @@ public void delete(long roomId, long memberId) { participationRepository.delete(participation); } + public void deleteAllByRoom(Room room) { + if (room.isNotOpened()) { + throw new CoreaException(ExceptionType.ROOM_STATUS_INVALID); + } + participationRepository.deleteAllByRoomId(room.getId()); + } + private void logCreateParticipation(Participation participation) { log.info("방에 참가했습니다. id={}, 방 id={}, 참가한 사용자 id={}, 역할={}, 원하는 매칭 인원={}", participation.getId(), participation.getRoomsId(), participation.getMembersId(), participation.getMemberRole(), participation.getMatchingSize()); } diff --git a/backend/src/main/java/corea/room/controller/RoomControllerSpecification.java b/backend/src/main/java/corea/room/controller/RoomControllerSpecification.java index a61e3597a..216575c39 100644 --- a/backend/src/main/java/corea/room/controller/RoomControllerSpecification.java +++ b/backend/src/main/java/corea/room/controller/RoomControllerSpecification.java @@ -32,7 +32,7 @@ public interface RoomControllerSpecification { "JWT 토큰에서 추출된 사용자 정보는 피드백 작성에 필요한 인증된 사용자 정보를 제공합니다. " + "

**참고:** 이 API를 사용하기 위해서는 유효한 JWT 토큰이 필요하며, " + "토큰이 없거나 유효하지 않은 경우 인증 오류가 발생합니다.") - @ApiErrorResponses(value = ExceptionType.MEMBER_NOT_FOUND) + @ApiErrorResponses(value = {ExceptionType.MEMBER_NOT_FOUND, ExceptionType.ROOM_MODIFY_AUTHORIZATION_ERROR}) ResponseEntity update(AuthInfo authInfo, RoomUpdateRequest request); @Operation(summary = "방 참가자들의 정보를 반환합니다.", @@ -54,7 +54,7 @@ ResponseEntity participants(@Parameter(description = " "JWT 토큰에서 추출된 사용자 정보는 방을 생성한 사용자와 일치하는지 파악합니다. " + "

**참고:** 이 API를 사용하기 위해서는 유효한 JWT 토큰이 필요하며, " + "토큰이 없거나 유효하지 않은 경우 인증 오류가 발생합니다.") - @ApiErrorResponses(value = ExceptionType.ROOM_DELETION_AUTHORIZATION_ERROR) + @ApiErrorResponses(value = ExceptionType.ROOM_MODIFY_AUTHORIZATION_ERROR) ResponseEntity delete(@Parameter(description = "방 아이디", example = "1") long id, AuthInfo authInfo); diff --git a/backend/src/main/java/corea/room/domain/RoomWriter.java b/backend/src/main/java/corea/room/domain/RoomWriter.java new file mode 100644 index 000000000..4343f6f00 --- /dev/null +++ b/backend/src/main/java/corea/room/domain/RoomWriter.java @@ -0,0 +1,71 @@ +package corea.room.domain; + +import corea.exception.CoreaException; +import corea.exception.ExceptionType; +import corea.member.domain.Member; +import corea.participation.domain.ParticipationWriter; +import corea.room.dto.RoomCreateRequest; +import corea.room.dto.RoomUpdateRequest; +import corea.room.repository.RoomRepository; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Slf4j +@Component +@RequiredArgsConstructor +@Transactional +public class RoomWriter { + + private static final int PLUS_HOURS_TO_MINIMUM_RECRUITMENT_DEADLINE = 1; + private static final int PLUS_DAYS_TO_MINIMUM_REVIEW_DEADLINE = 1; + + private final RoomRepository roomRepository; + private final ParticipationWriter participationWriter; + + // TODO 서비스 용 DTO 만들어야함 + public Room create(Member manager, RoomCreateRequest request) { +// validateDeadLine(request.recruitmentDeadline(), request.reviewDeadline()); + Room room = roomRepository.save(request.toEntity(manager)); + log.info("방을 생성했습니다. 방 생성자 id={}, 요청한 사용자 id={}", room.getId(), room.getManagerId()); + return room; + } + + public Room update(Room room, Member manager, RoomUpdateRequest request) { + validate(room, manager); + return roomRepository.save(request.toEntity(room, manager)); + } + + public void delete(Room room, Member manager) { + validate(room, manager); + roomRepository.delete(room); + participationWriter.deleteAllByRoom(room); + log.info("방을 삭제했습니다. 방 id={}, 사용자 iD={}", room.getId(), manager.getId()); + } + + private void validate(Room room, Member member) { + if (room.isNotMatchingManager(member.getId())) { + log.warn("인증되지 않은 방 변경 시도 방 생성자 id={}, 요청한 사용자 id={}", room.getId(), member.getId()); + throw new CoreaException(ExceptionType.ROOM_MODIFY_AUTHORIZATION_ERROR); + } + if (room.isNotOpened()) { + throw new CoreaException(ExceptionType.ROOM_STATUS_INVALID); + } + } + +// private void validateDeadLine(LocalDateTime recruitmentDeadline, LocalDateTime reviewDeadline) { +// LocalDateTime currentDateTime = LocalDateTime.now(); +// +// LocalDateTime minimumRecruitmentDeadline = currentDateTime.plusHours(PLUS_HOURS_TO_MINIMUM_RECRUITMENT_DEADLINE); +// if (recruitmentDeadline.isBefore(minimumRecruitmentDeadline)) { +// throw new CoreaException(ExceptionType.INVALID_RECRUITMENT_DEADLINE, +// String.format("모집 마감 시간은 현재 시간보다 %d시간 이후여야 합니다.", PLUS_HOURS_TO_MINIMUM_RECRUITMENT_DEADLINE)); +// } +// LocalDateTime minimumReviewDeadline = recruitmentDeadline.plusDays(PLUS_DAYS_TO_MINIMUM_REVIEW_DEADLINE); +// if (reviewDeadline.isBefore(minimumReviewDeadline)) { +// throw new CoreaException(ExceptionType.INVALID_REVIEW_DEADLINE, +// String.format("리뷰 마감 시간은 모집 마감 시간보다 %d일 이후여야 합니다.", PLUS_DAYS_TO_MINIMUM_REVIEW_DEADLINE)); +// } +// } +} diff --git a/backend/src/main/java/corea/room/dto/RoomUpdateRequest.java b/backend/src/main/java/corea/room/dto/RoomUpdateRequest.java index e5d099e30..b1a0a586a 100644 --- a/backend/src/main/java/corea/room/dto/RoomUpdateRequest.java +++ b/backend/src/main/java/corea/room/dto/RoomUpdateRequest.java @@ -57,19 +57,16 @@ public record RoomUpdateRequest(@Schema(description = "방 ID", example = "99") RoomClassification classification ) { - private static final int INITIAL_PARTICIPANTS_SIZE = 1; - private static final RoomStatus INITIAL_ROOM_STATUS = RoomStatus.OPEN; - - public Room toEntity(Member manager) { + public Room toEntity(Room room, Member manager) { return new Room( roomId, title, content, matchingSize, repositoryLink, thumbnailLink, keywords, - INITIAL_PARTICIPANTS_SIZE, limitedParticipants, + room.getCurrentParticipantsSize(), limitedParticipants, manager, recruitmentDeadline, reviewDeadline, classification, - INITIAL_ROOM_STATUS + room.getStatus() ); } } diff --git a/backend/src/main/java/corea/room/service/RoomService.java b/backend/src/main/java/corea/room/service/RoomService.java index 6aa860ac8..c6dc1d52e 100644 --- a/backend/src/main/java/corea/room/service/RoomService.java +++ b/backend/src/main/java/corea/room/service/RoomService.java @@ -4,21 +4,22 @@ import corea.exception.ExceptionType; import corea.matchresult.repository.MatchResultRepository; import corea.member.domain.Member; +import corea.member.domain.MemberReader; import corea.member.domain.MemberRole; -import corea.member.repository.MemberRepository; import corea.participation.domain.Participation; +import corea.participation.domain.ParticipationReader; import corea.participation.domain.ParticipationStatus; import corea.participation.domain.ParticipationWriter; import corea.participation.repository.ParticipationRepository; import corea.room.domain.Room; +import corea.room.domain.RoomReader; +import corea.room.domain.RoomWriter; import corea.room.dto.*; -import corea.room.repository.RoomRepository; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -29,84 +30,49 @@ @Transactional(readOnly = true) public class RoomService { - private static final int PLUS_HOURS_TO_MINIMUM_RECRUITMENT_DEADLINE = 1; - private static final int PLUS_DAYS_TO_MINIMUM_REVIEW_DEADLINE = 1; private static final int RANDOM_DISPLAY_PARTICIPANTS_SIZE = 6; - private final RoomRepository roomRepository; - private final MemberRepository memberRepository; private final MatchResultRepository matchResultRepository; private final ParticipationRepository participationRepository; private final RoomAutomaticService roomAutomaticService; private final ParticipationWriter participationWriter; + private final MemberReader memberReader; + private final RoomWriter roomWriter; + private final ParticipationReader participationReader; + private final RoomReader roomReader; @Transactional public RoomResponse create(long memberId, RoomCreateRequest request) { -// validateDeadLine(request.recruitmentDeadline(), request.reviewDeadline()); - - Member manager = memberRepository.findById(memberId) - .orElseThrow(() -> new CoreaException(ExceptionType.MEMBER_NOT_FOUND)); - Room room = roomRepository.save(request.toEntity(manager)); - log.info("방을 생성했습니다. 방 생성자 id={}, 요청한 사용자 id={}", room.getManagerId(), memberId); + Member manager = memberReader.findOne(memberId); + Room room = roomWriter.create(manager, request); Participation participation = participationWriter.create(room, manager, MemberRole.REVIEWER, ParticipationStatus.MANAGER); - participationRepository.save(participation); roomAutomaticService.createAutomatic(room); - return RoomResponse.of(room, participation.getMemberRole(), ParticipationStatus.MANAGER); } - private void validateDeadLine(LocalDateTime recruitmentDeadline, LocalDateTime reviewDeadline) { - LocalDateTime currentDateTime = LocalDateTime.now(); - - LocalDateTime minimumRecruitmentDeadline = currentDateTime.plusHours(PLUS_HOURS_TO_MINIMUM_RECRUITMENT_DEADLINE); - if (recruitmentDeadline.isBefore(minimumRecruitmentDeadline)) { - throw new CoreaException(ExceptionType.INVALID_RECRUITMENT_DEADLINE, - String.format("모집 마감 시간은 현재 시간보다 %d시간 이후여야 합니다.", PLUS_HOURS_TO_MINIMUM_RECRUITMENT_DEADLINE)); - } - LocalDateTime minimumReviewDeadline = recruitmentDeadline.plusDays(PLUS_DAYS_TO_MINIMUM_REVIEW_DEADLINE); - if (reviewDeadline.isBefore(minimumReviewDeadline)) { - throw new CoreaException(ExceptionType.INVALID_REVIEW_DEADLINE, - String.format("리뷰 마감 시간은 모집 마감 시간보다 %d일 이후여야 합니다.", PLUS_DAYS_TO_MINIMUM_REVIEW_DEADLINE)); - } - } - @Transactional public RoomResponse update(long memberId, RoomUpdateRequest request) { - Room room = getRoom(request.roomId()); - if (room.isNotMatchingManager(memberId)) { - throw new CoreaException(ExceptionType.MEMBER_IS_NOT_MANAGER); - } - Member member = memberRepository.findById(memberId) - .orElseThrow(() -> new CoreaException(ExceptionType.MEMBER_NOT_FOUND)); + Room room = roomReader.find(request.roomId()); + Member member = memberReader.findOne(memberId); - Room updatedRoom = roomRepository.save(request.toEntity(member)); - Participation participation = participationRepository.findByRoomIdAndMemberId(updatedRoom.getId(), memberId) - .orElseThrow(() -> new CoreaException(ExceptionType.NOT_PARTICIPATED_ROOM)); + Room updatedRoom = roomWriter.update(room, member, request); + MemberRole memberRole = participationReader.findMemberRole(room.getId(), memberId); roomAutomaticService.updateTime(updatedRoom); - return RoomResponse.of(updatedRoom, participation.getMemberRole(), ParticipationStatus.MANAGER); + return RoomResponse.of(updatedRoom, memberRole, ParticipationStatus.MANAGER); } @Transactional public void delete(long roomId, long memberId) { - Room room = getRoom(roomId); - validateDeletionAuthority(room, memberId); + Room room = roomReader.find(roomId); + Member member = memberReader.findOne(memberId); - log.info("방을 삭제했습니다. 방 id={}, 사용자 iD={}", roomId, memberId); - roomRepository.delete(room); - participationRepository.deleteAllByRoomId(roomId); + roomWriter.delete(room, member); roomAutomaticService.deleteAutomatic(room); } - private void validateDeletionAuthority(Room room, long memberId) { - if (room.isNotMatchingManager(memberId)) { - log.warn("방 삭제 권한이 없습니다. 방 생성자만 방을 삭제할 수 있습니다. 방 생성자 id={}, 요청한 사용자 id={}", room.getManagerId(), memberId); - throw new CoreaException(ExceptionType.ROOM_DELETION_AUTHORIZATION_ERROR); - } - } - public RoomParticipantResponses findParticipants(long roomId, long memberId) { List participants = new ArrayList<>(participationRepository.findAllByRoomId(roomId) .stream() @@ -140,11 +106,6 @@ private RoomParticipantResponse getRoomParticipantResponse(long roomId, Particip } public RoomResponse getRoomById(long roomId) { - return RoomResponse.from(getRoom(roomId)); - } - - private Room getRoom(long roomId) { - return roomRepository.findById(roomId) - .orElseThrow(() -> new CoreaException(ExceptionType.ROOM_NOT_FOUND, String.format("해당 Id의 방이 없습니다. 입력된 Id=%d", roomId))); + return RoomResponse.from(roomReader.find(roomId)); } } diff --git a/backend/src/test/java/corea/room/service/RoomServiceTest.java b/backend/src/test/java/corea/room/service/RoomServiceTest.java index a6d2e0182..82be4aeda 100644 --- a/backend/src/test/java/corea/room/service/RoomServiceTest.java +++ b/backend/src/test/java/corea/room/service/RoomServiceTest.java @@ -80,7 +80,8 @@ void manager() { @Test @DisplayName("방을 생성할 때 모집 마감 시간은 현재 시간보다 1시간 이후가 아니라면 예외가 발생한다.") void invalidRecruitmentDeadline() { - RoomCreateRequest request = RoomFixture.ROOM_CREATE_REQUEST_WITH_RECRUITMENT_DEADLINE(LocalDateTime.now().plusMinutes(59)); + RoomCreateRequest request = RoomFixture.ROOM_CREATE_REQUEST_WITH_RECRUITMENT_DEADLINE(LocalDateTime.now() + .plusMinutes(59)); assertThatThrownBy(() -> roomService.create(manager.getId(), request)) .asInstanceOf(InstanceOfAssertFactories.type(CoreaException.class)) @@ -92,7 +93,9 @@ void invalidRecruitmentDeadline() { @Test @DisplayName("방을 생성할 때 리뷰 마감 시간은 모집 마감 시간보다 1일 이후가 아니라면 예외가 발생한다.") void invalidReviewDeadline() { - RoomCreateRequest request = RoomFixture.ROOM_CREATE_REQUEST(LocalDateTime.now().plusHours(2), LocalDateTime.now().plusDays(1)); + RoomCreateRequest request = RoomFixture.ROOM_CREATE_REQUEST(LocalDateTime.now() + .plusHours(2), LocalDateTime.now() + .plusDays(1)); assertThatThrownBy(() -> roomService.create(manager.getId(), request)) .asInstanceOf(InstanceOfAssertFactories.type(CoreaException.class)) @@ -111,6 +114,22 @@ void delete() { assertThat(roomRepository.findById(roomId)).isEmpty(); } + @Test + @DisplayName("방이 닫힌 상태면 삭제할 수 없다.") + void throw_exception_when_delete_with_room_is_closed() { + Room room = roomRepository.save(RoomFixture.ROOM_DOMAIN_WITH_CLOSED(manager)); + assertThatThrownBy(() -> roomService.delete(room.getId(), manager.getId())) + .isInstanceOf(CoreaException.class); + } + + @Test + @DisplayName("방이 진행 상태면 삭제할 수 없다.") + void throw_exception_when_delete_with_room_is_progress() { + Room room = roomRepository.save(RoomFixture.ROOM_DOMAIN_WITH_PROGRESS(manager)); + assertThatThrownBy(() -> roomService.delete(room.getId(), manager.getId())) + .isInstanceOf(CoreaException.class); + } + @Test @DisplayName("방을 생성한 유저가 아닌 사람이 방을 삭제하려고 하면 예외가 발생한다.") void invalidDelete() { @@ -121,7 +140,7 @@ void invalidDelete() { assertThatThrownBy(() -> roomService.delete(response.id(), member.getId())) .asInstanceOf(InstanceOfAssertFactories.type(CoreaException.class)) .extracting(CoreaException::getExceptionType) - .isEqualTo(ExceptionType.ROOM_DELETION_AUTHORIZATION_ERROR); + .isEqualTo(ExceptionType.ROOM_MODIFY_AUTHORIZATION_ERROR); } @Test @@ -133,6 +152,22 @@ void throw_exception_when_update_with_not_manager() { .isInstanceOf(CoreaException.class); } + @Test + @DisplayName("방이 닫힌 상태면 수정할 수 없다.") + void throw_exception_when_update_with_room_is_closed() { + Room room = roomRepository.save(RoomFixture.ROOM_DOMAIN_WITH_CLOSED(manager)); + assertThatThrownBy(() -> roomService.update(room.getId(), RoomFixture.ROOM_UPDATE_REQUEST(room.getId()))) + .isInstanceOf(CoreaException.class); + } + + @Test + @DisplayName("방이 진행 상태면 수정할 수 없다.") + void throw_exception_when_update_with_room_is_progress() { + Room room = roomRepository.save(RoomFixture.ROOM_DOMAIN_WITH_PROGRESS(manager)); + assertThatThrownBy(() -> roomService.update(room.getId(), RoomFixture.ROOM_UPDATE_REQUEST(room.getId()))) + .isInstanceOf(CoreaException.class); + } + @Test @DisplayName("존재하지 않는 방이면, 예외를 발생합니다.") void throw_exception_when_update_with_not_exist_room() { @@ -153,9 +188,13 @@ void findParticipants() { List members = memberRepository.saveAll(MemberFixture.SEVEN_MEMBERS()); participationRepository.save(new Participation(room, manager, MemberRole.REVIEWER, ParticipationStatus.MANAGER, room.getMatchingSize())); - participationRepository.saveAll(members.stream().map(member -> new Participation(room, member, MemberRole.BOTH, 2)).toList()); + participationRepository.saveAll(members.stream() + .map(member -> new Participation(room, member, MemberRole.BOTH, 2)) + .toList()); - matchResultRepository.saveAll(members.stream().map(member -> MatchResultFixture.MATCH_RESULT_DOMAIN(room.getId(), manager, member)).toList()); + matchResultRepository.saveAll(members.stream() + .map(member -> MatchResultFixture.MATCH_RESULT_DOMAIN(room.getId(), manager, member)) + .toList()); matchResultRepository.save(MatchResultFixture.MATCH_RESULT_DOMAIN(room.getId(), members.get(0), manager)); RoomParticipantResponses participants = roomService.findParticipants(room.getId(), manager.getId()); @@ -178,9 +217,13 @@ void findParticipants_withNoPullRequestParticipants() { List members = memberRepository.saveAll(MemberFixture.SEVEN_MEMBERS()); - participationRepository.saveAll(members.stream().map(member -> new Participation(room, member, MemberRole.BOTH, 2)).toList()); + participationRepository.saveAll(members.stream() + .map(member -> new Participation(room, member, MemberRole.BOTH, 2)) + .toList()); - matchResultRepository.saveAll(members.stream().map(member -> MatchResultFixture.MATCH_RESULT_DOMAIN(room.getId(), manager, member)).toList()); + matchResultRepository.saveAll(members.stream() + .map(member -> MatchResultFixture.MATCH_RESULT_DOMAIN(room.getId(), manager, member)) + .toList()); matchResultRepository.save(MatchResultFixture.MATCH_RESULT_DOMAIN(room.getId(), members.get(0), manager)); RoomParticipantResponses participants = assertDoesNotThrow(() -> roomService.findParticipants(room.getId(), manager.getId()));