From 0e56a7d834440e8cb73f8b22d32120dfeec03eb9 Mon Sep 17 00:00:00 2001 From: swonny Date: Tue, 16 Apr 2024 02:13:22 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=EC=82=AC=EC=9A=A9=EC=9E=90=20=EC=95=84?= =?UTF-8?q?=EC=9D=B4=EB=94=94=EC=97=90=20=ED=95=B4=EB=8B=B9=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EC=9B=B9=EC=86=8C=EC=BC=93=EC=84=B8=EC=85=98=20?= =?UTF-8?q?=EB=B0=98=ED=99=98=20=EB=A9=94=EC=84=9C=EB=93=9C=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ddang/chat/domain/WebSocketSessionsTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/backend/ddang/src/test/java/com/ddang/ddang/chat/domain/WebSocketSessionsTest.java b/backend/ddang/src/test/java/com/ddang/ddang/chat/domain/WebSocketSessionsTest.java index 15fe5846a..b3dc381c5 100644 --- a/backend/ddang/src/test/java/com/ddang/ddang/chat/domain/WebSocketSessionsTest.java +++ b/backend/ddang/src/test/java/com/ddang/ddang/chat/domain/WebSocketSessionsTest.java @@ -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; @@ -84,6 +86,19 @@ void setUp() { assertThat(actual).isFalse(); } + @Test + void 유저아이디에_해당하는_웹소켓세션을_반환한다() { + // given + given(session.getAttributes()).willReturn(세션_attribute_정보); + sessions.putIfAbsent(session, 채팅방_아이디); + + // when + final Optional actual = sessions.findByUserId(사용자_아이디); + + // then + assertThat(actual.get()).isEqualTo(session); + } + @Test void 세션을_제거한다() { // given