Search in sources :

Example 6 with ErrorTypeMatcher

use of org.mule.runtime.core.api.exception.ErrorTypeMatcher in project mule by mulesoft.

the class SingleErrorTypeMatcherTestCase method matchEqual.

@Test
public void matchEqual() {
    ErrorTypeMatcher transformationMatcher = new SingleErrorTypeMatcher(transformationErrorType);
    assertThat(transformationMatcher.match(transformationErrorType), is(true));
}
Also used : ErrorTypeMatcher(org.mule.runtime.core.api.exception.ErrorTypeMatcher) SingleErrorTypeMatcher(org.mule.runtime.core.api.exception.SingleErrorTypeMatcher) SingleErrorTypeMatcher(org.mule.runtime.core.api.exception.SingleErrorTypeMatcher) Test(org.junit.Test)

Example 7 with ErrorTypeMatcher

use of org.mule.runtime.core.api.exception.ErrorTypeMatcher 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));
}
Also used : ErrorType(org.mule.runtime.api.message.ErrorType) ErrorTypeMatcher(org.mule.runtime.core.api.exception.ErrorTypeMatcher) SingleErrorTypeMatcher(org.mule.runtime.core.api.exception.SingleErrorTypeMatcher) SingleErrorTypeMatcher(org.mule.runtime.core.api.exception.SingleErrorTypeMatcher) Test(org.junit.Test)

Example 8 with ErrorTypeMatcher

use of org.mule.runtime.core.api.exception.ErrorTypeMatcher in project mule by mulesoft.

the class SingleErrorTypeMatcherTestCase method doesNotMatchSibling.

@Test
public void doesNotMatchSibling() {
    ErrorTypeMatcher transformationMatcher = new SingleErrorTypeMatcher(transformationErrorType);
    assertThat(transformationMatcher.match(expressionErrorType), is(false));
}
Also used : ErrorTypeMatcher(org.mule.runtime.core.api.exception.ErrorTypeMatcher) SingleErrorTypeMatcher(org.mule.runtime.core.api.exception.SingleErrorTypeMatcher) SingleErrorTypeMatcher(org.mule.runtime.core.api.exception.SingleErrorTypeMatcher) Test(org.junit.Test)

Example 9 with ErrorTypeMatcher

use of org.mule.runtime.core.api.exception.ErrorTypeMatcher in project mule by mulesoft.

the class DisjunctiveErrorTypeMatcherTestCase method allMatch.

@Test
public void allMatch() {
    ErrorType mockErrorType = mock(ErrorType.class);
    when(mockErrorType.getParentErrorType()).thenReturn(transformationErrorType);
    ErrorTypeMatcher matcherWithTwoTransformation = createMatcher(transformationErrorType, mockErrorType);
    assertThat(matcherWithTwoTransformation.match(mockErrorType), is(true));
}
Also used : ErrorType(org.mule.runtime.api.message.ErrorType) DisjunctiveErrorTypeMatcher(org.mule.runtime.core.api.exception.DisjunctiveErrorTypeMatcher) ErrorTypeMatcher(org.mule.runtime.core.api.exception.ErrorTypeMatcher) SingleErrorTypeMatcher(org.mule.runtime.core.api.exception.SingleErrorTypeMatcher) Test(org.junit.Test)

Example 10 with ErrorTypeMatcher

use of org.mule.runtime.core.api.exception.ErrorTypeMatcher in project mule by mulesoft.

the class SingleErrorTypeMatcherTestCase method doesNotMatchParent.

@Test
public void doesNotMatchParent() {
    ErrorTypeMatcher transformationMatcher = new SingleErrorTypeMatcher(transformationErrorType);
    assertThat(transformationMatcher.match(anyErrorType), is(false));
}
Also used : ErrorTypeMatcher(org.mule.runtime.core.api.exception.ErrorTypeMatcher) SingleErrorTypeMatcher(org.mule.runtime.core.api.exception.SingleErrorTypeMatcher) SingleErrorTypeMatcher(org.mule.runtime.core.api.exception.SingleErrorTypeMatcher) Test(org.junit.Test)

Aggregations

ErrorTypeMatcher (org.mule.runtime.core.api.exception.ErrorTypeMatcher)12 SingleErrorTypeMatcher (org.mule.runtime.core.api.exception.SingleErrorTypeMatcher)12 Test (org.junit.Test)9 ErrorType (org.mule.runtime.api.message.ErrorType)6 DisjunctiveErrorTypeMatcher (org.mule.runtime.core.api.exception.DisjunctiveErrorTypeMatcher)4 ErrorTypeRepository (org.mule.runtime.api.exception.ErrorTypeRepository)3 List (java.util.List)2 Optional (java.util.Optional)2 Consumer (java.util.function.Consumer)2 Collectors.toList (java.util.stream.Collectors.toList)2 ComponentIdentifier (org.mule.runtime.api.component.ComponentIdentifier)2 ComponentIdentifier.buildFromStringRepresentation (org.mule.runtime.api.component.ComponentIdentifier.buildFromStringRepresentation)2 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)2 I18nMessageFactory.createStaticMessage (org.mule.runtime.api.i18n.I18nMessageFactory.createStaticMessage)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 TRUE (java.lang.Boolean.TRUE)1 String.format (java.lang.String.format)1 ArrayList (java.util.ArrayList)1 Arrays.stream (java.util.Arrays.stream)1 Collections.singletonList (java.util.Collections.singletonList)1