Added invalid context test

This commit is contained in:
Xavi Aracil
2022-11-25 14:09:17 +01:00
parent c72d1de7f4
commit 5cb232ea5b
4 changed files with 42 additions and 8 deletions
@@ -99,6 +99,14 @@ public class OB20Inspector extends Inspector {
// we expect the above to place a generated object in the context
Assertion assertion = ctx.getGeneratedObject(Assertion.ID);
//context and type properties
CredentialEnum type = assertion.getCredentialType();
for(Probe<JsonNode> probe : List.of(new ContextPropertyProbe(type), new TypePropertyProbe(type))) {
probeCount++;
accumulator.add(probe.run(assertion.getJson(), ctx));
if(broken(accumulator)) return abort(ctx, accumulator, probeCount);
}
// let's compact
accumulator.add(getCompactionProbe(assertion).run(assertion, ctx));
if(broken(accumulator, true)) return abort(ctx, accumulator, probeCount);
@@ -108,14 +116,6 @@ public class OB20Inspector extends Inspector {
accumulator.add(new JsonLDValidationProbe(jsonLdGeneratedObject).run(assertion, ctx));
if(broken(accumulator, true)) return abort(ctx, accumulator, probeCount);
//context and type properties
CredentialEnum type = assertion.getCredentialType();
for(Probe<JsonNode> probe : List.of(new ContextPropertyProbe(type), new TypePropertyProbe(type))) {
probeCount++;
accumulator.add(probe.run(assertion.getJson(), ctx));
if(broken(accumulator)) return abort(ctx, accumulator, probeCount);
}
//canonical schema and inline schemata
// SchemaKey schema = assertion.getSchemaKey().orElseThrow();
// for(Probe<JsonNode> probe : List.of(new JsonSchemaProbe(schema), new InlineJsonSchemaProbe(schema))) {