SetMailboxesRequest implements JmapRequest { public static Builder builder() { return new Builder(); } @VisibleForTesting  SetMailboxesRequest(ImmutableMap<MailboxCreationId, MailboxCreateRequest> create, ImmutableMap<MailboxId,MailboxUpdateRequest> update, ImmutableList<MailboxId> destroy); static Builder builder(); ImmutableMap<MailboxCreationId, MailboxCreateRequest> getCreate(); ImmutableMap<MailboxId,MailboxUpdateRequest> getUpdate(); ImmutableList<MailboxId> getDestroy();  }
@Test(expected = NotImplementedException.class) public void builderShouldThrowWhenAccountId() { SetMailboxesRequest.builder().accountId("1"); }
@Test(expected = NotImplementedException.class) public void builderShouldThrowWhenIfInState() { SetMailboxesRequest.builder().ifInState("1"); }
@Test public void builderShouldWork() throws MailboxException { MailboxCreationId creationId = MailboxCreationId.of("creationId"); InMemoryId mailboxId = InMemoryId.of(123); MailboxCreateRequest mailboxRequest = MailboxCreateRequest.builder() .name("mailboxRequest") .build(); ImmutableList<MailboxId> destroy = ImmutableList.of(InMemoryId.of(456)); MailboxUpdateRequest mailboxUpdateRequest = MailboxUpdateRequest.builder() .name("mailboxUpdateRequest") .build(); SetMailboxesRequest expected = new SetMailboxesRequest(ImmutableMap.of(creationId, mailboxRequest), ImmutableMap.of(mailboxId, mailboxUpdateRequest), destroy); SetMailboxesRequest actual = SetMailboxesRequest.builder() .create(creationId, mailboxRequest) .update(mailboxId, mailboxUpdateRequest) .destroy(destroy) .build(); assertThat(actual).isEqualToComparingFieldByField(expected); }