}
public void testCantGetLocationOfInvalidNode() throws OperationException {
AnnotationTree<Object> annotations = new AnnotationTree<Object>(
"a", "b", null);
RawDocumentImpl rawDoc = RawDocumentImpl.PROVIDER.parse("<doc><p></p></doc>");
IndexedDocumentImpl<Node, Element, Text, ?> doc =
new IndexedDocumentImpl<Node, Element, Text, Void>(rawDoc, annotations,
DocumentSchema.NO_SCHEMA_CONSTRAINTS);
Node element = doc.getDocumentElement().getFirstChild();
// element is valid
assertEquals(0, doc.getLocation(element));
doc.consumeAndReturnInvertible(Nindo.deleteElement(0));
// element was deleted
try {
doc.getLocation(element);
fail("Expected: IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// OK
}
// element that was never valid to begin with
try {
doc.getLocation(rawDoc.createElement("abc", Collections.<String, String>emptyMap(),
doc.getDocumentElement(), null));
fail("Expected: IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// OK
}