Search in sources :

Example 1 with CarDoor

use of org.mule.test.subtypes.extension.CarDoor in project mule by mulesoft.

the class SubTypesMappingParserTestCase method doorRetriever.

@Test
public void doorRetriever() throws Exception {
    CoreEvent responseEvent = flowRunner("doorRetriever").withPayload("").run();
    assertThat(responseEvent.getMessage().getPayload().getValue(), instanceOf(CarDoor.class));
    CarDoor payload = (CarDoor) responseEvent.getMessage().getPayload().getValue();
    assertThat(payload.getColor(), is("blue"));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) CarDoor(org.mule.test.subtypes.extension.CarDoor) Test(org.junit.Test)

Example 2 with CarDoor

use of org.mule.test.subtypes.extension.CarDoor in project mule by mulesoft.

the class SubTypesMappingParserTestCase method subtypedAndConcreteParametersAsAttributes.

@Test
public void subtypedAndConcreteParametersAsAttributes() throws Exception {
    CoreEvent responseEvent = flowRunner("subtypedAndConcreteParametersAsAttributes").withPayload("").run();
    assertThat(responseEvent.getMessage().getPayload().getValue(), notNullValue());
    List<Object> payload = (List<Object>) responseEvent.getMessage().getPayload().getValue();
    assertThat(payload, hasSize(7));
    assertThat(payload.get(1), instanceOf(CarDoor.class));
    assertThat(((CarDoor) payload.get(1)).getColor(), is("white"));
    assertThat(payload.get(5), instanceOf(Triangle.class));
    assertThat(((Triangle) payload.get(5)).getHeight(), is(6));
    assertThat(((Triangle) payload.get(5)).getArea(), is(3));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Triangle(org.mule.test.subtypes.extension.Triangle) PojoForList(org.mule.test.subtypes.extension.PojoForList) List(java.util.List) CarDoor(org.mule.test.subtypes.extension.CarDoor) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)2 CarDoor (org.mule.test.subtypes.extension.CarDoor)2 List (java.util.List)1 PojoForList (org.mule.test.subtypes.extension.PojoForList)1 Triangle (org.mule.test.subtypes.extension.Triangle)1