final Main prog = new Main(null);
final String testString = "To jest trudne zdanie. A to następne. A to przedostatnie jest.\u0002 Test ostatniego.";
final Locale plLoc = new Locale("pl", "PL", "");
final PropertyValue[] prop = new PropertyValue[0];
for (int i = 0; i<=testString.length(); i++) {
final ProofreadingResult paRes = prog.doProofreading("1", testString, plLoc, i, testString.length(), prop);
assertEquals("1", paRes.aDocumentIdentifier);
assertTrue(paRes.nStartOfNextSentencePosition >= i);
if (i < "To jest trudne zdanie. ".length()) {
assertEquals("To jest trudne zdanie. ".length(), paRes.nStartOfNextSentencePosition);
assertEquals(0, paRes.nStartOfSentencePosition);
}
}
final ProofreadingResult paRes1 = prog.doProofreading("1", testString, plLoc, 0, testString.length(), prop);
assertEquals("1", paRes1.aDocumentIdentifier);
assertEquals(23, paRes1.nStartOfNextSentencePosition);
assertEquals(0, paRes1.nStartOfSentencePosition);
//that was causing NPE but not anymore:
final String testString2 = "To jest „nowy problem”. A to inny jeszcze( „problem. Co jest „?";
final ProofreadingResult paRes2 = prog.doProofreading("1", testString2, plLoc, 0, testString2.length(), prop);
assertEquals("1", paRes2.aDocumentIdentifier);
assertEquals(24, paRes2.nStartOfNextSentencePosition);
assertEquals(0, paRes2.nStartOfSentencePosition);
}