use of ddf.catalog.util.Describable in project ddf by codice.
the class MetacardValidityMarkerPluginTest method getMockFailingValidatorWithErrorsAndWarnings.
private MetacardValidator getMockFailingValidatorWithErrorsAndWarnings() throws ValidationException {
ValidationException validationException = mock(ValidationException.class);
when(validationException.getErrors()).thenReturn(Collections.singletonList(SAMPLE_ERROR));
when(validationException.getWarnings()).thenReturn(Collections.singletonList(SAMPLE_WARNING));
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.util.Describable in project ddf by codice.
the class MetacardValidityMarkerPluginTest method getMockFailingValidatorWithWarnings.
private MetacardValidator getMockFailingValidatorWithWarnings() throws ValidationException {
ValidationException validationException = mock(ValidationException.class);
when(validationException.getWarnings()).thenReturn(Collections.singletonList(SAMPLE_WARNING));
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.util.Describable in project ddf by codice.
the class MetacardValidityMarkerPluginTest method getMockEnforcedPassingValidatorWithId.
private MetacardValidator getMockEnforcedPassingValidatorWithId(String id) {
MetacardValidator metacardValidator = mock(MetacardValidator.class, withSettings().extraInterfaces(Describable.class));
when(((Describable) metacardValidator).getId()).thenReturn(id);
return metacardValidator;
}
use of ddf.catalog.util.Describable 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.util.Describable 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