Skip to content

Commit

Permalink
test: 사용자 아이디에 해당하는 웹소켓세션 반환 메서드 테스트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
swonny committed Apr 15, 2024
1 parent 514e0ac commit 0e56a7d
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.junit.jupiter.api.Test;
import org.springframework.web.socket.WebSocketSession;

import java.util.Optional;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -84,6 +86,19 @@ void setUp() {
assertThat(actual).isFalse();
}

@Test
void 유저아이디에_해당하는_웹소켓세션을_반환한다() {
// given
given(session.getAttributes()).willReturn(세션_attribute_정보);
sessions.putIfAbsent(session, 채팅방_아이디);

// when
final Optional<WebSocketSession> actual = sessions.findByUserId(사용자_아이디);

// then
assertThat(actual.get()).isEqualTo(session);
}

@Test
void 세션을_제거한다() {
// given
Expand Down

0 comments on commit 0e56a7d

Please sign in to comment.