Cluster cluster = mock(Cluster.class);
ClusterMessageListener testSubject = new ClusterMessageListener(cluster,
new DefaultAMQPMessageConverter(serializer));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
EventMessageWriter outputStream = new EventMessageWriter(new DataOutputStream(baos), serializer);
outputStream.writeEventMessage(new GenericEventMessage<String>("Event"));
byte[] body = baos.toByteArray();
body = new String(body, Charset.forName("UTF-8")).replace("string", "strong")
.getBytes(Charset.forName("UTF-8"));
testSubject.onMessage(new Message(body, new MessageProperties()));