use of org.mule.runtime.api.message.ErrorType in project mule by mulesoft.
the class DisjunctiveErrorTypeMatcherTestCase method noMatch.
@Test
public void noMatch() {
ErrorType mockErrorType = mock(ErrorType.class);
when(mockErrorType.getParentErrorType()).thenReturn(anyErrorType);
ErrorTypeMatcher matcherWithTwoTransformation = createMatcher(transformationErrorType, expressionErrorType);
assertThat(matcherWithTwoTransformation.match(mockErrorType), is(false));
}
use of org.mule.runtime.api.message.ErrorType in project mule by mulesoft.
the class DisjunctiveErrorTypeMatcherTestCase method oneMatch.
@Test
public void oneMatch() {
ErrorType mockErrorType = mock(ErrorType.class);
when(mockErrorType.getParentErrorType()).thenReturn(transformationErrorType);
ErrorTypeMatcher matcherWithTransformation = createMatcher(transformationErrorType, expressionErrorType);
assertThat(matcherWithTransformation.match(transformationErrorType), is(true));
assertThat(matcherWithTransformation.match(mockErrorType), is(true));
}
use of org.mule.runtime.api.message.ErrorType in project mule by mulesoft.
the class SingleErrorTypeMatcherTestCase method matchChild.
@Test
public void matchChild() {
ComponentIdentifier customTransformerIdentifier = ComponentIdentifier.builder().name("custom").namespace(CORE_NAMESPACE_NAME).build();
ErrorTypeRepository errorTypeRepository = muleContext.getErrorTypeRepository();
ErrorType customTransformerErrorType = errorTypeRepository.addErrorType(customTransformerIdentifier, transformationErrorType);
ErrorTypeMatcher transformationMatcher = new SingleErrorTypeMatcher(transformationErrorType);
assertThat(transformationMatcher.match(customTransformerErrorType), is(true));
}
use of org.mule.runtime.api.message.ErrorType in project mule by mulesoft.
the class SingleErrorTypeMatcherTestCase method anyMatchsAll.
@Test
public void anyMatchsAll() {
ErrorType mockErrorType = mock(ErrorType.class);
when(mockErrorType.getParentErrorType()).thenReturn(transformationErrorType);
ErrorTypeMatcher anyMatcher = new SingleErrorTypeMatcher(anyErrorType);
assertThat(anyMatcher.match(anyErrorType), is(true));
assertThat(anyMatcher.match(transformationErrorType), is(true));
assertThat(anyMatcher.match(expressionErrorType), is(true));
assertThat(anyMatcher.match(mockErrorType), is(true));
}
use of org.mule.runtime.api.message.ErrorType in project mule by mulesoft.
the class DefaultMessageProcessorChainTestCase method before.
@Before
public void before() throws MuleException {
nonBlockingProcessorsExecuted.set(0);
muleContext = spy(super.muleContext);
ErrorTypeLocator errorTypeLocator = mock(ErrorTypeLocator.class);
ErrorType errorType = mock(ErrorType.class);
ExceptionContextProvider exceptionContextProvider = mock(ExceptionContextProvider.class);
MuleConfiguration muleConfiguration = mock(MuleConfiguration.class);
when(muleConfiguration.isContainerMode()).thenReturn(false);
when(muleConfiguration.getId()).thenReturn(randomNumeric(3));
when(muleConfiguration.getShutdownTimeout()).thenReturn(1000L);
when(muleContext.getConfiguration()).thenReturn(muleConfiguration);
when(((PrivilegedMuleContext) muleContext).getErrorTypeLocator()).thenReturn(errorTypeLocator);
when(muleContext.getExceptionContextProviders()).thenReturn(singletonList(exceptionContextProvider));
when(errorTypeLocator.lookupErrorType((Exception) any())).thenReturn(errorType);
flow = builder("flow", muleContext).processingStrategyFactory(processingStrategyFactory).build();
flow.initialise();
flow.start();
}
Aggregations