### Question:
DatastreamHistoryLog { public void addVersion(InputStream content, String contentType, Date created) { Element versionEl = new Element(VERSION_TAG, DCR_PACKAGING_NS) .setAttribute(CREATED_ATTR, DateTimeUtil.formatDateToUTC(created)) .setAttribute(CONTENT_TYPE_ATTR, contentType); try { if (XML_TYPE_TEXT.equals(contentType) || XML_TYPE_APP.equals(contentType)) { Document contentDoc = SecureXMLFactory.createSAXBuilder().build(content); Element contentRoot = contentDoc.getRootElement(); versionEl.addContent(contentRoot.detach()); } else { versionEl.setText(IOUtils.toString(content, UTF_8)); } } catch (JDOMException | IOException e) { throw new ServiceException("Failed to add new version of " + datastreamPid.getQualifiedId(), e); } historyDoc.getRootElement().addContent(versionEl); } DatastreamHistoryLog(PID datastreamPid);  DatastreamHistoryLog(PID datastreamPid, InputStream logStream); void addVersion(InputStream content, String contentType, Date created); InputStream toInputStream(); static final String HISTORY_TAG; static final String VERSION_TAG; static final String ID_ATTR; static final String CONTENT_TYPE_ATTR; static final String CREATED_ATTR; }### Answer:
@Test(expected = ServiceException.class) public void addVersion_NewLog_TextContentWithXmlType_Fail() throws Exception { DatastreamHistoryLog historyLog = new DatastreamHistoryLog(dsPid); String dsContent = "all of my content"; InputStream contentStream = new ByteArrayInputStream(dsContent.getBytes()); historyLog.addVersion(contentStream, "text/xml", VERSION1_DATE); }