WebSocketMessageDecoder implements Decoder.Text<Message> { @Override public Message decode(String event) throws DecodeException { try { return objMapper.readValue(event, Message.class); } catch (IOException e) { throw new DecodeException("Could not decode event", e.getMessage()); } }  @Override void init(EndpointConfig config); @Override Message decode(String event); @Override boolean willDecode(String eventStr); @Override void destroy();  }
@Test public void testDecode() throws Exception { Message message = underTest.decode(messageJsonStr); assertNotNull(message); }
@Test (expected = DecodeException.class) public void testDecode_withException() throws Exception { underTest.decode("broken event"); }