getNodeByIdentifier may fail with RuntimeException - add tests, one of which currently ignored
@@ -50,6 +50,7 @@ import javax.jcr.GuestCredentials;
import javax.jcr.InvalidItemStateException;
import javax.jcr.Item;
import javax.jcr.ItemExistsException;
+import javax.jcr.ItemNotFoundException;
import javax.jcr.NamespaceException;
import javax.jcr.NamespaceRegistry;
import javax.jcr.NoSuchWorkspaceException;
@@ -375,6 +376,27 @@ public class RepositoryTest extends AbstractRepositoryTest {
assertTrue(node.isSame(node2));
}
+ @Test
+ public void getNodeByIncorrectIdentifier() throws RepositoryException {
+ Node node = getNode("/foo");
+ String id = node.getIdentifier() + "foofoofoo";
+ try {
+ getAdminSession().getNodeByIdentifier(id);
+ fail("should not get here");
+ } catch (ItemNotFoundException expected) {
+ }
+ }
+
+ @Ignore
+ @Test
+ public void getNodeByEmptyIdentifier() throws RepositoryException {
+ try {
+ getAdminSession().getNodeByIdentifier("");
+ fail("should not get here");
+ } catch (RepositoryException expected) {
+ }
+ }
+
@Test
public void getNodeByUUID() throws RepositoryException {
Node node = getNode("/foo").addNode("boo");
