BAEL-252(A Java Client to consume a WebSockets API) (#1791)

* @BAEL-252 - Initial checkin

* BAEL-252 : Added junit tests
This commit is contained in:
Kalyan
2017-05-07 01:55:39 +05:30
committed by maibin
parent 2c790c40cb
commit 4a3662b4ab
5 changed files with 162 additions and 4 deletions

View File

@@ -0,0 +1,26 @@
package com.baeldung.websocket.client;
import org.baeldung.websocket.client.MyStompSessionHandler;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.messaging.simp.stomp.StompHeaders;
import org.springframework.messaging.simp.stomp.StompSession;
/**
* Test class for MyStompSessionHandler
* @author Kalyan
*
*/
public class MyStompSessionHandlerTest {
@Test
public void testAfterConnectedSuccessfull() {
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());
}
}