### Question:
Snapshot implements Serializable { public static Builder builder() { return new Builder(); } protected  Snapshot(FilterType filterType, Optional<Long> uidNext, Collection<Email> emails); static Builder builder(); boolean containsAllIds(List<ServerId> serverIds); FilterType getFilterType(); Optional<Long> getUidNext(); Collection<Email> getEmails(); MessageSet getMessageSet(); @Override final int hashCode(); @Override final boolean equals(Object object); @Override String toString();  }### Answer:
@Test (expected=IllegalStateException.class) public void testNullFilterType() { Snapshot.builder().uidNext(15).build(); }
@Test public void testBuilder() { FilterType filterType = FilterType.ONE_DAY_BACK; long uidNext = 2; long emailUID = 3; Email email = Email.builder() .uid(emailUID) .read(false) .date(DateUtils.getCurrentDate()) .build(); long emailUID2 = 4; Email email2 = Email.builder() .uid(emailUID2) .read(true) .date(DateUtils.getCurrentDate()) .build(); Snapshot snapshot = Snapshot.builder() .filterType(filterType) .uidNext(uidNext) .addEmail(email) .addEmail(email2) .build(); assertThat(snapshot.getFilterType()).isEqualTo(filterType); assertThat(snapshot.getUidNext()).contains(uidNext); assertThat(snapshot.getEmails()).containsExactly(email, email2); assertThat(snapshot.getMessageSet().asDiscreteValues()).containsOnly(emailUID, emailUID2); }