Search in sources :

Example 1 with Describable

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;
}
Also used : Metacard(ddf.catalog.data.Metacard) ValidationException(ddf.catalog.validation.ValidationException) MetacardValidator(ddf.catalog.validation.MetacardValidator) Describable(ddf.catalog.util.Describable)

Example 2 with Describable

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;
}
Also used : Metacard(ddf.catalog.data.Metacard) ValidationException(ddf.catalog.validation.ValidationException) MetacardValidator(ddf.catalog.validation.MetacardValidator) Describable(ddf.catalog.util.Describable)

Example 3 with Describable

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;
}
Also used : MetacardValidator(ddf.catalog.validation.MetacardValidator) Describable(ddf.catalog.util.Describable)

Example 4 with Describable

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;
}
Also used : Metacard(ddf.catalog.data.Metacard) ValidationException(ddf.catalog.validation.ValidationException) MetacardValidator(ddf.catalog.validation.MetacardValidator) Describable(ddf.catalog.util.Describable)

Example 5 with Describable

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;
}
Also used : ValidationException(ddf.catalog.validation.ValidationException) MetacardValidator(ddf.catalog.validation.MetacardValidator) Describable(ddf.catalog.util.Describable)

Aggregations

Describable (ddf.catalog.util.Describable)5 MetacardValidator (ddf.catalog.validation.MetacardValidator)5 ValidationException (ddf.catalog.validation.ValidationException)4 Metacard (ddf.catalog.data.Metacard)3