### Question:
EmailViewAttachments { public static Builder builder() { return new Builder(); } private  EmailViewAttachments(List<EmailViewAttachment> attachments); static Builder builder(); List<EmailViewAttachment> getEmailViewAttachments(); @Override final int hashCode(); @Override final boolean equals(Object object); @Override String toString();  }### Answer:
@Test public void testDisplayNameWhenNoNameNoContentId() { Optional<String> displayName = getDisplayNameOfMimePart(MimePartImpl.builder() .contentType("text/plain") .build()); assertThat(displayName.isPresent()).isFalse(); }
@Test public void testDisplayNameWhenName() { Optional<String> displayName = getDisplayNameOfMimePart(MimePartImpl.builder() .contentType("text/plain") .bodyParams(BodyParams.builder().add( new BodyParam("name", "hello")) .build()) .build()); assertThat(displayName.isPresent()).isTrue(); assertThat(displayName.get()).isEqualTo("hello"); }
@Test public void testDisplayNameWhenContentId() { Optional<String> displayName = getDisplayNameOfMimePart(MimePartImpl.builder() .contentType("text/plain") .contentId("hello") .build()); assertThat(displayName.isPresent()).isTrue(); assertThat(displayName.get()).isEqualTo("ATT00000"); }
@Test public void testDisplayNameGetNameWhenBoth() { Optional<String> displayName = getDisplayNameOfMimePart(MimePartImpl.builder() .contentType("text/plain") .contentId("hello contentId") .bodyParams(BodyParams.builder().add( new BodyParam("name", "hello Name")) .build()) .build()); assertThat(displayName.isPresent()).isTrue(); assertThat(displayName.get()).isEqualTo("hello Name"); }
@Test public void testDisplayNameWhenExtensionMapped() { Optional<String> displayName = getDisplayNameOfMimePart(MimePartImpl.builder() .contentType("image/jpeg") .contentId("hello contentId") .bodyParams(BodyParams.builder().add( new BodyParam("name", "hello Name")) .build()) .build()); assertThat(displayName.isPresent()).isTrue(); assertThat(displayName.get()).isEqualTo("hello Name"); }
@Test(expected=IllegalStateException.class) public void buildShouldThrowWhenNoUid() { EmailViewAttachments.builder().build(); }
@Test(expected=IllegalStateException.class) public void buildShouldThrowWhenNoCollectionId() { EmailViewAttachments.builder().uid(1l).build(); }