ErrorAttachmentLog extends AbstractLog { public static ErrorAttachmentLog attachmentWithText(String text, String fileName) { if (text == null) { text = ""; } return attachmentWithBinary(text.getBytes(CHARSET), fileName, CONTENT_TYPE_TEXT_PLAIN); }  static ErrorAttachmentLog attachmentWithText(String text, String fileName); static ErrorAttachmentLog attachmentWithBinary(byte[] data, String fileName, String contentType); @Override String getType(); UUID getId(); void setId(UUID id); UUID getErrorId(); void setErrorId(UUID errorId); String getContentType(); @SuppressWarnings("WeakerAccess") void setContentType(String contentType); String getFileName(); @SuppressWarnings("WeakerAccess") void setFileName(String fileName); byte[] getData(); void setData(byte[] data); boolean isValid(); @SuppressWarnings("ConstantConditions") @Override void read(JSONObject object); @Override void write(JSONStringer writer); @SuppressWarnings({"SimplifiableIfStatement", "EqualsReplaceableByObjectsCall"}) @Override boolean equals(Object o); @Override int hashCode(); @SuppressWarnings("WeakerAccess")
    static final String CONTENT_TYPE_TEXT_PLAIN; static final String TYPE; }
@Test public void attachmentWithText() { String text = "Hello World!"; String fileName = "1"; ErrorAttachmentLog attachment = ErrorAttachmentLog.attachmentWithText(text, fileName); assertNotNull(attachment); assertEquals(text, new String(attachment.getData(), CHARSET)); assertEquals(fileName, attachment.getFileName()); assertEquals(ErrorAttachmentLog.CONTENT_TYPE_TEXT_PLAIN, attachment.getContentType()); }