ValidatorPrototypeBuilder builder =
new ValidatorPrototypeBuilder(validatorFactoryMock);
ElementSchema schema1 =
new ElementSchemaImpl(containingElement, aReferenceMock);
// Create validators for the same model so the element validator
// should be the same.
ElementValidator validator1 = builder.build(schema1);
assertEquals(
"Element validator should match", elementValidatorMock,
validator1);
// Create validator for a different model but using part of the
// previous model so the content validator should be reused.
ContentModel bounded = new BoundedContentImpl(aReferenceMock);
ElementSchema schema2 =
new ElementSchemaImpl(containingElement, bounded);
ElementValidator validator3 = builder.build(schema2);
assertEquals(
"Second element validator should match", elementValidator2Mock,
validator3);