Search in sources :

Example 1 with MyStompSessionHandler

use of org.baeldung.websocket.client.MyStompSessionHandler in project tutorials by eugenp.

the class MyStompSessionHandlerIntegrationTest method givenValidSession_whenConnected_SendsMessage.

@Test
public void givenValidSession_whenConnected_SendsMessage() {
    StompSession mockSession = Mockito.mock(StompSession.class);
    StompHeaders mockHeader = Mockito.mock(StompHeaders.class);
    MyStompSessionHandler sessionHandler = new MyStompSessionHandler();
    sessionHandler.afterConnected(mockSession, mockHeader);
    Mockito.verify(mockSession).subscribe("/topic/messages", sessionHandler);
    Mockito.verify(mockSession).send(Mockito.anyString(), Mockito.anyObject());
}
Also used : StompSession(org.springframework.messaging.simp.stomp.StompSession) MyStompSessionHandler(org.baeldung.websocket.client.MyStompSessionHandler) StompHeaders(org.springframework.messaging.simp.stomp.StompHeaders) Test(org.junit.Test)

Aggregations

MyStompSessionHandler (org.baeldung.websocket.client.MyStompSessionHandler)1 Test (org.junit.Test)1 StompHeaders (org.springframework.messaging.simp.stomp.StompHeaders)1 StompSession (org.springframework.messaging.simp.stomp.StompSession)1