AttachmentMetadata { public static Builder builder() { return new Builder(); } private  AttachmentMetadata(AttachmentId attachmentId, ContentType type, long size); static Builder builder(); AttachmentId getAttachmentId(); ContentType getType(); long getSize(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test void builderShouldThrowWhenAttachmentIdIsNull() { assertThatThrownBy(() -> AttachmentMetadata.builder() .attachmentId(null)) .isInstanceOf(IllegalArgumentException.class); }
@Test void builderShouldThrowWhenTypeIsNull() { assertThatThrownBy(() -> AttachmentMetadata.builder() .type((String) null)) .isInstanceOf(IllegalArgumentException.class); }
@Test void builderShouldThrowWhenTypeIsEmpty() { assertThatThrownBy(() -> AttachmentMetadata.builder() .type("")) .isInstanceOf(IllegalArgumentException.class); }
@Test void buildShouldThrowWhenAttachmentIdIsNotProvided() { assertThatThrownBy(() -> AttachmentMetadata.builder() .build()) .isInstanceOf(IllegalStateException.class); }
@Test void buildShouldThrowWhenSizeIsNotProvided() { assertThatThrownBy(() -> AttachmentMetadata.builder() .attachmentId(AttachmentId.random()) .type("TYPE") .build()) .isInstanceOf(IllegalStateException.class); }
@Test void buildShouldThrowWhenTypeIsNotProvided() { assertThatThrownBy(() -> AttachmentMetadata.builder() .attachmentId(AttachmentId.random()) .size(36) .build()) .isInstanceOf(IllegalStateException.class); }
@Test void sizeShouldThrowOnNegativeValue() { assertThatThrownBy(() -> AttachmentMetadata.builder() .attachmentId(AttachmentId.random()) .size(-3)) .isInstanceOf(IllegalArgumentException.class); }