use of org.mule.runtime.core.api.exception.Errors.Identifiers.CONNECTIVITY_ERROR_IDENTIFIER in project mule by mulesoft.
the class ErrorsDeclarationEnricherTestCase method extensionErrorsInheritFromMuleErrors.
@Test
public void extensionErrorsInheritFromMuleErrors() {
extensionModel = loadExtension(HeisenbergExtension.class);
OperationModel cureCancer = getNamedObject(extensionModel.getOperationModels(), "cureCancer");
assertThat(cureCancer.getErrorModels(), hasItem(hasProperty(TYPE, is(HEALTH.getType()))));
Optional<ErrorModel> healthError = extensionModel.getErrorModels().stream().filter(errorModel -> errorModel.getType().equals(HEALTH.getType())).findFirst();
assertThat(healthError.isPresent(), is(true));
Optional<ErrorModel> optConnectivityError = healthError.get().getParent();
assertThat(optConnectivityError.isPresent(), is(true));
ErrorModel connectivityError = optConnectivityError.get();
assertThat(connectivityError.getType(), is(CONNECTIVITY_ERROR_IDENTIFIER));
assertThat(connectivityError.getNamespace(), is(HEISENBERG));
Optional<ErrorModel> optMuleConnectivityError = connectivityError.getParent();
assertThat(optMuleConnectivityError.isPresent(), is(true));
ErrorModel muleConnectivityError = optMuleConnectivityError.get();
assertThat(muleConnectivityError.getType(), is(CONNECTIVITY_ERROR_IDENTIFIER));
assertThat(muleConnectivityError.getNamespace(), is(MULE_NAMESPACE));
}
Aggregations