stefan-egli commented on code in PR #560:
URL: https://github.com/apache/jackrabbit-oak/pull/560#discussion_r874713263
##########
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitBuilderTest.java:
##########
@@ -150,6 +150,18 @@ public void addNodeState() {
assertNotNull(op);
}
+ @Test(expected = DocumentStoreException.class)
+ public void addLongNameNodeState() {
+ Path path = Path.fromString(DocumentMK.LONG_PATH);
+ CommitBuilder builder = new CommitBuilder(ns, null);
+ builder.addNode(path);
+ Commit c = builder.build(ns.newRevision());
+ UpdateOp up = c.getUpdateOperationForNode(path);
+ UpdateOp.Operation op = up.getChanges().get(
+ new UpdateOp.Key("_deleted", c.getRevision()));
+ assertNotNull(op);
+ }
Review Comment:
builder.addNode is expected to throw an exception here - what about removing
the code below and replacing it with
```suggestion
fail("should not reach this point");
}
```
##########
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDocumentStoreTest.java:
##########
@@ -241,6 +244,19 @@ public void queryWithLimit() throws Exception {
store.dispose();
}
+ @Test(expected = DocumentStoreException.class)
+ public void queryWithNodeNameTooLong() {
+ DocumentStore docStore = openDocumentStore();
+ DocumentNodeStore store =
builderProvider.newBuilder().setDocumentStore(docStore).setAsyncDelay(0).getNodeStore();
+ Revision rev = Revision.newRevision(0);
+ List<UpdateOp> inserts = Lists.newArrayList();
+ for (int i = 0; i < 2; i++) {
+ DocumentNodeState n = new DocumentNodeState(store,
Path.fromString(DocumentMK.LONG_PATH + i),
+ new RevisionVector(rev));
+ inserts.add(n.asOperation(rev));
+ }
Review Comment:
Same thing as with the other test : it expects to fail but doesn't assert
that explicitly (just implicitly that the test itself should throw an
exception). Might be matter of taste, but this would be an alternative:
```suggestion
DocumentNodeState n = new DocumentNodeState(store,
Path.fromString(DocumentMK.LONG_PATH + i),
new RevisionVector(rev));
inserts.add(n.asOperation(rev));
fail("should not reach this point");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]