@Test
public void triggersCombinedSchemaEvents() {

    ValidationListener listener = mock(ValidationListener.class);
    StringSchema stringSchema = StringSchema.builder().requiresString(true).build();
    EmptySchema emptySchema = EmptySchema.builder().build();
    ObjectSchema objectSchema = ObjectSchema.builder().requiresObject(true).build();
    CombinedSchema combinedSchema = CombinedSchema.builder().criterion(CombinedSchema.ONE_CRITERION)
            .subschema(stringSchema)
            .subschema(emptySchema)
            .subschema(objectSchema)
            .build();
    ValidationFailureReporter reporter = new CollectingFailureReporter(combinedSchema);
    JSONObject instance = new JSONObject();
    new ValidatingVisitor(instance, reporter, ReadWriteValidator.NONE, listener).visit(combinedSchema);
    ValidationException exc = new InternalValidationException(stringSchema, String.class, instance);
    verify(listener).combinedSchemaMismatch(new CombinedSchemaMismatchEvent(combinedSchema, stringSchema, instance, exc));
    verify(listener).combinedSchemaMatch(new CombinedSchemaMatchEvent(combinedSchema, emptySchema, instance));
    verify(listener).combinedSchemaMatch(new CombinedSchemaMatchEvent(combinedSchema, objectSchema, instance));
}