}
private void verifyReplaceWithParagraphByBasicCases(String fileName) {
try {
doc = (TextDocument) Document.loadDocument(ResourceUtilities
.getAbsolutePath(fileName));
search = new TextNavigation("#1", doc);
while (search.hasNext()) {
OdfElement description = search.nextSelection().getElement();
OdfElement replacement = (OdfElement) description
.getNextSibling();
Assert.assertNotNull(replacement);
Assert.assertEquals("Hello2 from source document!",
TextExtractor.getText(replacement));
}
search = new TextNavigation("#2", doc);
while (search.hasNext()) {
OdfElement description = search.nextSelection().getElement();
String contents;
do {
OdfElement replacement = (OdfElement) description
.getNextSibling();
Assert.assertNotNull(replacement);
contents = TextExtractor.getText(replacement);
if (contents.contains("<<target>>")) {
Assert.fail();
}
} while (contents.startsWith("#"));
}
search = new TextNavigation("#3", doc);
OdfElement description = search.nextSelection().getElement();
TextParagraphElementBase replacement = (TextParagraphElementBase) description
.getNextSibling();
Assert.assertEquals("Hello2 from source document!",
TextExtractor.getText(replacement));