### Question:
CLIParser extends AbstractCLIParser { @Override public <T> ObligationParsingResult getObligations(Attachment attachment, User user, T context) throws TException { AttachmentContent attachmentContent = attachmentContentProvider.getAttachmentContent(attachment); ObligationParsingResult result = new ObligationParsingResult(); InputStream attachmentStream = null; try { attachmentStream = attachmentConnector.getAttachmentStream(attachmentContent, user, context); Document doc = getDocument(attachmentStream); result.setObligationsAtProject(getObligations(doc)); result.setAttachmentContentId(attachment.getAttachmentContentId()); result.setStatus(ObligationInfoRequestStatus.SUCCESS); } catch (ParserConfigurationException | IOException | XPathExpressionException | SAXException | SW360Exception e) { log.error(e); result.setStatus(ObligationInfoRequestStatus.FAILURE).setMessage("Error while parsing CLI file: " + e.toString()); } finally { closeQuietly(attachmentStream, log); } return result; } CLIParser(AttachmentConnector attachmentConnector, AttachmentContentProvider attachmentContentProvider); @Override boolean isApplicableTo(Attachment attachment, User user, T context); @Override List<LicenseInfoParsingResult> getLicenseInfos(Attachment attachment, User user, T context); @Override ObligationParsingResult getObligations(Attachment attachment, User user, T context);  }### Answer:
@Test public void testGetCLIObligations() throws Exception { Attachment cliAttachment = new Attachment("A1", "a.xml"); when(connector.getAttachmentStream(anyObject(), anyObject(), anyObject())).thenReturn(new ReaderInputStream(new StringReader(CLI_TESTFILE))); ObligationParsingResult oblRes = parser.getObligations(cliAttachment, new User(), new Project()); assertThat(oblRes.getStatus(), is(ObligationInfoRequestStatus.SUCCESS)); assertThat(oblRes.getObligationsAtProjectSize(), is(2)); assertThat(oblRes.getObligationsAtProject().get(0).getTopic(), equalTo("do not change the nature of the package")); assertThat(oblRes.getObligationsAtProject().get(1).getText(), equalTo("In any case contact your 3rd Party Software Manager to check the copyleft effect\n")); assertThat(oblRes.getObligationsAtProject().get(1).getLicenseIDsSize(), is(4)); assertThat(oblRes.getObligationsAtProject().get(1).getLicenseIDs(), containsInAnyOrder("GPL-1.0+", "GPL-2.0", "GPL-2.0+", "LGPL-2.1+")); }