spring-guides / gs-messaging-stomp-websocket

Using WebSocket to build an interactive web application :: Learn how to the send and receive messages between a browser and the server over a WebSocket

Home Page:http://spring.io/guides/gs/messaging-stomp-websocket/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changing return from HelloMessage to String in Test fails

norricorp opened this issue · comments

I know this is not a problem with the code but I am interested to know the answer.
I have replaced the use of both Greeting and HelloMessage POJO's with String.
This works except for the unit test (so I skipTests).
The problem appears to be in getPayLoadType in GreetingIntegrationTests.java.
Here is the code change

					public Type getPayloadType(StompHeaders headers) {
						System.out.println("DEBUG: into getPayloadType");
						return String.class;
					}

Output shows the debug message but no return. Which means that it times out

		if (latch.await(3, TimeUnit.SECONDS)) {
			if (failure.get() != null) {
				throw new AssertionError("", failure.get());
			}
		}
		else {
			fail("DEBUG: Greeting not received");
		}

and the not received message is received.
So code changes in the actual code is correct but I have made mistakes in the integation test code.
Any ideas?
Regards,

I guess you forgot to set the MessageConverter in the test? E.g.

		this.stompClient.setMessageConverter(new StringMessageConverter());