@Test public void testGetDocumentCas() throws ResourceInitializationException, IOException, SAXException, URISyntaxException, ParserConfigurationException { CAS aCAS = CasCreationUtils.createCas( XmiFileTreeCorpusDAO.getTypeSystem(corpusPathString), null, null, null); corpusDAO.getDocumentCas(new URI("62007.txt"), "1", aCAS); assertThat(aCAS.getDocumentText(), containsString("РИА Новости")); assertEquals(6, CasUtil.selectAll(aCAS).size()); assertEquals( 1, CasUtil.select(aCAS, CasUtil.getAnnotationType(aCAS, "ru.kfu.itis.issst.evex.Weapon")) .size()); aCAS = CasCreationUtils.createCas( XmiFileTreeCorpusDAO.getTypeSystem(corpusPathString), null, null, null); corpusDAO.getDocumentCas(new URI("62007.txt"), "5", aCAS); assertThat(aCAS.getDocumentText(), containsString("РИА Новости")); assertThat(CasUtil.selectAll(aCAS).size(), equalTo(5)); assertEquals( 0, CasUtil.select(aCAS, CasUtil.getAnnotationType(aCAS, "ru.kfu.itis.issst.evex.Weapon")) .size()); }
@Test(expected = FileNotFoundException.class) public void testGetDocumentCasForWrongAnnotator() throws ResourceInitializationException, IOException, SAXException, URISyntaxException, ParserConfigurationException { CAS aCAS = CasCreationUtils.createCas( XmiFileTreeCorpusDAO.getTypeSystem(corpusPathString), null, null, null); corpusDAO.getDocumentCas(new URI("75788.txt"), "1", aCAS); }
@Test(expected = FileNotFoundException.class) public void testGetAnnotatorIdsForNonexistingDocument() throws URISyntaxException, IOException { corpusDAO.getAnnotatorIds(new URI("49580.txt")); }
@Test public void testGetAnnotatorIds() throws URISyntaxException, IOException { assertEquals(Sets.newHashSet("1", "5"), corpusDAO.getAnnotatorIds(new URI("62007.txt"))); assertEquals(Sets.newHashSet("1"), corpusDAO.getAnnotatorIds(new URI("65801.txt"))); assertEquals(Sets.newHashSet("5"), corpusDAO.getAnnotatorIds(new URI("75788.txt"))); }
@Test public void testGetDocuments() throws URISyntaxException { assertEquals( Sets.newHashSet(new URI("62007.txt"), new URI("65801.txt"), new URI("75788.txt")), corpusDAO.getDocuments()); }