Search in sources :

Example 1 with LocatedMuleException

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

the class LocatedMuleExceptionTestCase method rawComponent.

@Test
public void rawComponent() {
    Object raw = mock(Object.class, withSettings().extraInterfaces(Component.class));
    when(raw.toString()).thenReturn("Mock@1");
    LocatedMuleException lme = new LocatedMuleException(raw);
    assertThat(lme.getInfo().get(INFO_LOCATION_KEY).toString(), is("Mock@1 @ app:internal:-1"));
}
Also used : NamedObject(org.mule.runtime.api.meta.NamedObject) Component(org.mule.runtime.api.component.Component) LocatedMuleException(org.mule.runtime.api.exception.LocatedMuleException) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 2 with LocatedMuleException

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

the class LocatedMuleExceptionTestCase method namedComponent.

@Test
public void namedComponent() {
    NamedObject named = mock(NamedObject.class, withSettings().extraInterfaces(Component.class));
    when(named.getName()).thenReturn("mockComponent");
    LocatedMuleException lme = new LocatedMuleException(named);
    assertThat(lme.getInfo().get(INFO_LOCATION_KEY).toString(), is("/mockComponent @ app:internal:-1"));
}
Also used : NamedObject(org.mule.runtime.api.meta.NamedObject) Component(org.mule.runtime.api.component.Component) LocatedMuleException(org.mule.runtime.api.exception.LocatedMuleException) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 3 with LocatedMuleException

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

the class LocatedMuleExceptionTestCase method namedAnnotatedComponent.

@Test
public void namedAnnotatedComponent() {
    Component namedAnnotated = mock(Component.class, withSettings().extraInterfaces(NamedObject.class));
    when(((NamedObject) namedAnnotated).getName()).thenReturn("mockComponent");
    when(namedAnnotated.getAnnotation(eq(docNameAttrName))).thenReturn("Mock Component");
    when(namedAnnotated.toString()).thenReturn("Mock@1");
    configureProcessorLocation(namedAnnotated);
    LocatedMuleException lme = new LocatedMuleException(namedAnnotated);
    assertThat(lme.getInfo().get(INFO_LOCATION_KEY).toString(), is("/mockComponent @ app:muleApp.xml:10 (Mock Component)"));
}
Also used : NamedObject(org.mule.runtime.api.meta.NamedObject) Component(org.mule.runtime.api.component.Component) LocatedMuleException(org.mule.runtime.api.exception.LocatedMuleException) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 4 with LocatedMuleException

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

the class LocatedMuleExceptionTestCase method annotatedComponent.

@Test
public void annotatedComponent() {
    Component annotated = mock(Component.class);
    when(annotated.getAnnotation(eq(docNameAttrName))).thenReturn("Mock Component");
    when(annotated.toString()).thenReturn("Mock@1");
    configureProcessorLocation(annotated);
    LocatedMuleException lme = new LocatedMuleException(annotated);
    assertThat(lme.getInfo().get(INFO_LOCATION_KEY).toString(), is("Mock@1 @ app:muleApp.xml:10 (Mock Component)"));
}
Also used : Component(org.mule.runtime.api.component.Component) LocatedMuleException(org.mule.runtime.api.exception.LocatedMuleException) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Aggregations

Test (org.junit.Test)4 Component (org.mule.runtime.api.component.Component)4 LocatedMuleException (org.mule.runtime.api.exception.LocatedMuleException)4 SmallTest (org.mule.tck.size.SmallTest)4 NamedObject (org.mule.runtime.api.meta.NamedObject)3