SetMessagesRequest implements JmapRequest { public static Builder builder() { return new Builder(); } @VisibleForTesting  SetMessagesRequest(Optional<String> accountId, Optional<String> ifInState,
                                          List<CreationMessageEntry> create, List<MDNCreationEntry> sendMDN,
                                          Map<MessageId, Function<UpdateMessagePatchConverter, UpdateMessagePatch>> update,
                                          List<MessageId> destroy); static Builder builder(); Optional<String> getAccountId(); Optional<String> getIfInState(); List<CreationMessageEntry> getCreate(); List<MDNCreationEntry> getSendMDN(); Map<MessageId, UpdateMessagePatch> buildUpdatePatches(UpdateMessagePatchConverter converter); List<MessageId> getDestroy();  }
@Test public void builderShouldThrowWhenAccountIdIsNotNull() { assertThatThrownBy(() -> SetMessagesRequest.builder().accountId("")) .isInstanceOf(NotImplementedException.class); }
@Test public void builderShouldThrowWhenIfInStateIsNotNull() { assertThatThrownBy(() -> SetMessagesRequest.builder().ifInState("")) .isInstanceOf(NotImplementedException.class); }
@Test public void builderShouldWork() { ImmutableList<MessageId> destroy = ImmutableList.of(TestMessageId.of(4)); SetMessagesRequest expected = new SetMessagesRequest(Optional.empty(), Optional.empty(), ImmutableList.of(), ImmutableList.of(), ImmutableMap.of(), destroy); SetMessagesRequest setMessagesRequest = SetMessagesRequest.builder() .accountId(null) .ifInState(null) .create(ImmutableMap.of()) .update(ImmutableMap.of()) .destroy(destroy) .build(); assertThat(setMessagesRequest).isEqualToComparingFieldByField(expected); }