Skip to content

Commit 0371462

Browse files
committed
DEVEXP-471 : Adding test when schemaUri does not exist.
1 parent 90b5781 commit 0371462

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

marklogic-client-api/src/test/java/com/marklogic/client/test/rows/ValidateDocTest.java

+12
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,16 @@ public void testWithJsonSchemaAndInvalidJsons() {
294294
assertTrue(expectedUris.contains("/acme/doc5.json"));
295295
assertTrue(expectedUris.contains("/acme/doc6.json"));
296296
}
297+
@Test
298+
public void testWithNonExistingSchema() {
299+
PlanBuilder.ModifyPlan plan = op
300+
.fromDocDescriptors(
301+
op.docDescriptor(newWriteOp("/acme/doc1.json", mapper.createObjectNode().put("count", 1).put("total",2)))
302+
).validateDoc(op.col("doc"),
303+
op.schemaDefinition("jsonSchema").withSchemaUri("/validateDoc/Non-Existing.json"));
304+
rowManager.execute(plan.write());
305+
DocumentManager docMgr = Common.client.newDocumentManager();
306+
assertNull(docMgr.exists("/acme/doc1.json"), "When a schema is used that doesn't exist, " +
307+
"the validation by the server is expected to silently fail, and thus the document is not written");
308+
}
297309
}

0 commit comments

Comments
 (0)