### Question:
UidMSEmail extends MSEmail implements Serializable, Indexed<Long> { public static Builder uidBuilder() { return new Builder() ; } private  UidMSEmail(long uid, MSEmail email); static Builder uidBuilder(); @Override PIMDataType getType(); @Override Long getIndex(); long getUid(); @Override final int hashCode(); @Override final boolean equals(Object obj); @Override String toString();  }### Answer:
@Test(expected=IllegalStateException.class) public void testUidMSEmailBuilderRequireUid() { UidMSEmail.uidBuilder() .email(createMock(MSEmail.class)) .build(); }
@Test(expected=IllegalStateException.class) public void testUidMSEmailBuilderRequireEmail() { UidMSEmail.uidBuilder() .uid(1l) .build(); }
@Test public void testUidMSEmailBuilderWithRequirement() { Set<MSAttachement> expectedAttachments = Sets.newHashSet(new MSAttachement()); MSEmailBody expectedMSEmailBody = createMock(MSEmailBody.class); MSEmailHeader expectedMSHeader = createMock(MSEmailHeader.class); MSMeetingRequest expectedMeetingRequest = createMock(MSMeetingRequest.class); MSEmail msEmailMock = createMock(MSEmail.class); expect(msEmailMock.getSubject()).andReturn("a subject"); expect(msEmailMock.getAttachments()).andReturn(expectedAttachments); expect(msEmailMock.getBody()).andReturn(expectedMSEmailBody); expect(msEmailMock.getHeader()).andReturn(expectedMSHeader); expect(msEmailMock.getImportance()).andReturn(MSImportance.HIGH); expect(msEmailMock.getMeetingRequest()).andReturn(expectedMeetingRequest); expect(msEmailMock.getMessageClass()).andReturn(MSMessageClass.SCHEDULE_MEETING_CANCELED); expect(msEmailMock.isAnswered()).andReturn(true); expect(msEmailMock.isStarred()).andReturn(true); expect(msEmailMock.isRead()).andReturn(true); replay(msEmailMock, expectedMSEmailBody, expectedMSHeader, expectedMeetingRequest); UidMSEmail uidMSEmail = UidMSEmail.uidBuilder() .uid(1l) .email(msEmailMock) .build(); verify(msEmailMock, expectedMSEmailBody, expectedMSHeader, expectedMeetingRequest); assertThat(uidMSEmail.getSubject()).isEqualTo("a subject"); assertThat(uidMSEmail.getAttachments()).isEqualTo(expectedAttachments); assertThat(uidMSEmail.getBody()).isSameAs(expectedMSEmailBody); assertThat(uidMSEmail.getHeader()).isSameAs(expectedMSHeader); assertThat(uidMSEmail.getImportance()).isEqualTo(MSImportance.HIGH); assertThat(uidMSEmail.getMeetingRequest()).isSameAs(expectedMeetingRequest); assertThat(uidMSEmail.getMessageClass()).isEqualTo(MSMessageClass.SCHEDULE_MEETING_CANCELED); assertThat(uidMSEmail.isAnswered()).isTrue(); assertThat(uidMSEmail.isAnswered()).isTrue(); assertThat(uidMSEmail.isAnswered()).isTrue(); }