MessageUtils { public static Message message(CloudType cloudType, Serializable payload, int ttl) { return new MessageImpl(cloudType, payload, ttl); }  static Optional<Message> retry(Message message); static boolean canRetry(Message message); static Message message(CloudType cloudType, Serializable payload, int ttl); static Message message(CloudType cloudType, Serializable payload); static Message message(Serializable payload); static String getRealQueueName(String queueName, CloudType cloudType);  }
@Test public void testMessageWithCloud() { String payload = "payload"; Message message = message(MOCK, payload, 5); assertThat(message.getId(), is(notNullValue())); assertThat(message.getCloudType(), is(notNullValue())); assertThat(message.getPayload(), equalTo(payload)); assertThat(message.getTtl(), equalTo(5)); }
@Test public void testMessageWithNoCloud() { String payload = "payload"; Message message = message(payload); assertThat(message.getId(), is(notNullValue())); assertThat(message.getCloudType(), is(nullValue())); assertThat(message.getPayload(), equalTo(payload)); assertThat(message.getTtl(), equalTo(1)); }