MessageAlteringUtils { public static Builder from(RedirectNotify mailet) { return new Builder(mailet); } private  MessageAlteringUtils(RedirectNotify mailet, Mail originalMail); static Builder from(RedirectNotify mailet);  }
@Test void buildShouldThrowWhenMailetIsNull() { assertThatThrownBy(() -> MessageAlteringUtils.from(null).build()) .isInstanceOf(NullPointerException.class) .hasMessage("'mailet' is mandatory"); }
@Test void buildShouldThrowWhenOriginalMailIsNull() { assertThatThrownBy(() -> MessageAlteringUtils.from(mock(RedirectNotify.class)) .build()) .isInstanceOf(NullPointerException.class) .hasMessage("'originalMail' is mandatory"); }
@Test void buildShouldWorkWhenEverythingProvided() { MessageAlteringUtils.from(mock(RedirectNotify.class)) .originalMail(mock(Mail.class)) .build(); }