use of ddf.catalog.validation.MetacardValidator in project ddf by codice.
the class MetacardValidityMarkerPluginTest method getMockFailingValidatorWithErrors.
private MetacardValidator getMockFailingValidatorWithErrors() throws ValidationException {
ValidationException validationException = mock(ValidationException.class);
when(validationException.getErrors()).thenReturn(Collections.singletonList(SAMPLE_ERROR));
MetacardValidator metacardValidator = mock(MetacardValidator.class, withSettings().extraInterfaces(Describable.class));
doThrow(validationException).when(metacardValidator).validate(any(Metacard.class));
when(((Describable) metacardValidator).getId()).thenReturn(ID);
return metacardValidator;
}
use of ddf.catalog.validation.MetacardValidator in project ddf by codice.
the class MetacardValidityMarkerPluginTest method getMockEnforcedFailingValidatorWithId.
private MetacardValidator getMockEnforcedFailingValidatorWithId(String id) throws ValidationException {
ValidationException validationException = mock(ValidationException.class);
when(validationException.getErrors()).thenReturn(Collections.singletonList(SAMPLE_ERROR));
MetacardValidator metacardValidator = mock(MetacardValidator.class, withSettings().extraInterfaces(Describable.class));
doThrow(validationException).when(metacardValidator).validate(argThat(isMetacardWithTitle(FIRST)));
when(((Describable) metacardValidator).getId()).thenReturn(id);
return metacardValidator;
}
Aggregations