### Question:
MessageSetUtils { public static MessageSet computeEmailsUID(Snapshot snapshot, long currentUIDNext) { Preconditions.checkNotNull(snapshot, "snapshot can't be null"); Preconditions.checkArgument(snapshot.getUidNext().isPresent(), "Cannot build range without UIDNEXT"); return MessageSet.from(snapshot.getMessageSet()) .add(Range.closedOpen(snapshot.getUidNext().get(), currentUIDNext)) .build(); } private  MessageSetUtils(); static MessageSet computeEmailsUID(Snapshot snapshot, long currentUIDNext);  }### Answer:
@Test(expected=NullPointerException.class) public void testComputeNullSnapshot() { MessageSetUtils.computeEmailsUID(null, 0); }
@Test public void testComputeWithoutEmailsInSnapshot() { Snapshot snapshot = Snapshot.builder() .filterType(FilterType.ONE_DAY_BACK) .uidNext(1) .build(); MessageSet messageSet = MessageSetUtils.computeEmailsUID(snapshot, 3); Iterable<Long> asDiscreteValues = messageSet.asDiscreteValues(); assertThat(asDiscreteValues).containsOnly(1L, 2L); }
@Test(expected=IllegalArgumentException.class) public void testComputeWithoutUIDNextInSnapshot() { Snapshot snapshot = Snapshot.builder() .filterType(FilterType.ONE_DAY_BACK) .build(); MessageSetUtils.computeEmailsUID(snapshot, 3); }