Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ public void gameEnd(Room room) {
room.initializePlayers();

List<Player> disconnectedPlayers = room.getDisconnectedPlayers();
roomService.handleDisconnectedPlayers(room, disconnectedPlayers);

if (!disconnectedPlayers.isEmpty()) {
roomService.handleDisconnectedPlayers(room, disconnectedPlayers);
} else {
messageSender.sendBroadcast(
destination, MessageType.PLAYER_LIST, toPlayerListResponse(room));
}

room.updateRoomState(RoomState.WAITING);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ public void exitRoomForDisconnectedPlayer(Long roomId, Player player, String ses
SystemNoticeResponse systemNoticeResponse =
ofPlayerEvent(player.nickname, RoomEventType.EXIT);

messageSender.sendBroadcast(
destination, MessageType.PLAYER_LIST, toPlayerListResponse(room));
messageSender.sendBroadcast(
destination, MessageType.SYSTEM_NOTICE, systemNoticeResponse);
messageSender.sendBroadcast(
destination, MessageType.PLAYER_LIST, toPlayerListResponse(room));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public void initializePlayers() {
.forEach(
player -> {
player.initializeCorrectCount();
player.toggleReady();
});
resetAllPlayerReadyStates();
}

public String getSessionIdByUserId(Long userId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,14 @@ class RoomServiceTests {

@Mock private RoomRepository roomRepository;
@Mock private QuizService quizService;
@Mock private GameService gameService;
@Mock private TimerService timerService;
@Mock private ApplicationEventPublisher eventPublisher;
@Mock private MessageSender messageSender;

@BeforeEach
void setUp() {
MockitoAnnotations.openMocks(this); // @Mock 어노테이션이 붙은 필드들을 초기화합니다.

roomService =
new RoomService(
timerService, quizService, roomRepository, eventPublisher, messageSender);
roomService = new RoomService(quizService, roomRepository, eventPublisher, messageSender);

SecurityContextHolder.clearContext();
}
Expand Down