@Test public void canConvertSentence() throws UIMAException { JCas jCas = JCasFactory.createJCas(); jCas.setDocumentText("This is a test. This is another test."); String[] words = new String[] {"This", "is", "another", "test", "."}; Sentence sentence2 = new Sentence(words, new int[] {16, 21, 24, 31, 35}, new int[] {20, 23, 30, 34, 36}, words); when(document.sentences()).thenReturn(new Sentence[] {sentence, sentence2}); DocumentConverter converter = new DocumentConverter(jCas, document); converter.convert(); Collection<uk.gov.dstl.baleen.types.language.Sentence> actual = JCasUtil.select(jCas, uk.gov.dstl.baleen.types.language.Sentence.class); assertEquals(2, actual.size()); Iterator<uk.gov.dstl.baleen.types.language.Sentence> iterator = actual.iterator(); uk.gov.dstl.baleen.types.language.Sentence next = iterator.next(); assertEquals(0, next.getBegin()); assertEquals(15, next.getEnd()); next = iterator.next(); assertEquals(16, next.getBegin()); assertEquals(36, next.getEnd()); }
public void convert() { for (Sentence sentence : document.sentences()) { convert(sentence); } }
DocumentConverter { public void convert() { for (Sentence sentence : document.sentences()) { convert(sentence); } } }
DocumentConverter { public void convert() { for (Sentence sentence : document.sentences()) { convert(sentence); } } DocumentConverter(JCas jCas, Document document); }
DocumentConverter { public void convert() { for (Sentence sentence : document.sentences()) { convert(sentence); } } DocumentConverter(JCas jCas, Document document); void convert(); }
DocumentConverter { public void convert() { for (Sentence sentence : document.sentences()) { convert(sentence); } } DocumentConverter(JCas jCas, Document document); void convert();  }