MessageBuilder { public V messageId(UUID messageId) { if (messageId == null) { throw new NullPointerException("Null messageId"); } this.messageId = messageId.toString(); return self(); } MessageBuilder(Message.Type type);   MessageBuilder(Message message); V messageId(UUID messageId); V messageId(String messageId); V timestamp(Date timestamp); V context(Map<String, ?> context); V anonymousId(UUID anonymousId); V anonymousId(String anonymousId); V userId(String userId); V enableIntegration(String key, boolean enable); V integrationOptions(String key, Map<String, ? super Object> options); T build(); Message.Type type();  }
@Test public void nullUUIDMessageIdThrowsException(TestUtils.MessageBuilderFactory builder) { try { builder.get().messageId((UUID) null); fail(); } catch (NullPointerException e) { assertThat(e).hasMessage("Null messageId"); } }
@Test public void nullStringMessageIdThrowsException(TestUtils.MessageBuilderFactory builder) { try { builder.get().messageId((String) null); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("messageId cannot be null or empty."); } }
@Test public void emptyStringMessageIdThrowsException(TestUtils.MessageBuilderFactory builder) { try { builder.get().messageId(""); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("messageId cannot be null or empty."); } }