Search in sources :

Example 1 with HouseDoor

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

the class SubTypesMappingParserTestCase method subtypedAndConcreteParameters.

@Test
public void subtypedAndConcreteParameters() throws Exception {
    CoreEvent responseEvent = flowRunner("subtypedAndConcreteParameters").withPayload("").run();
    assertThat(responseEvent.getMessage().getPayload().getValue(), notNullValue());
    List<Object> payload = (List<Object>) responseEvent.getMessage().getPayload().getValue();
    assertThat(payload, hasSize(7));
    assertThat(payload.get(0), instanceOf(ParentShape.class));
    assertThat(((ParentShape) payload.get(0)).getArea(), is(2));
    assertThat(payload.get(1), instanceOf(HouseDoor.class));
    assertThat(((HouseDoor) payload.get(1)).isLocked(), is(false));
    assertThat(payload.get(2), instanceOf(FinalPojo.class));
    assertThat(((FinalPojo) payload.get(2)).getSomeString(), is("asChild"));
    assertThat(payload.get(3), instanceOf(VeganCookBook.class));
    assertThat(((VeganCookBook) payload.get(3)).getNumberOfPages(), is(1));
    assertThat(payload.get(4), instanceOf(Square.class));
    assertThat(((Square) payload.get(4)).getSide(), is(4));
    assertThat(((Square) payload.get(4)).getArea(), is(16));
    assertThat(payload.get(5), instanceOf(Triangle.class));
    assertThat(((Triangle) payload.get(5)).getHeight(), is(4));
    assertThat(((Triangle) payload.get(5)).getArea(), is(2));
    assertThat(payload.get(6), instanceOf(NoReferencePojo.class));
    assertThat(((NoReferencePojo) payload.get(6)).getNumber(), is(1));
    assertThat(((NoReferencePojo) payload.get(6)).getString(), is("noRef"));
}
Also used : NoReferencePojo(org.mule.test.subtypes.extension.NoReferencePojo) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) FinalPojo(org.mule.test.subtypes.extension.FinalPojo) Triangle(org.mule.test.subtypes.extension.Triangle) HouseDoor(org.mule.test.subtypes.extension.HouseDoor) PojoForList(org.mule.test.subtypes.extension.PojoForList) List(java.util.List) ParentShape(org.mule.test.subtypes.extension.ParentShape) Square(org.mule.test.subtypes.extension.Square) VeganCookBook(org.mule.test.vegan.extension.VeganCookBook) Test(org.junit.Test)

Aggregations

List (java.util.List)1 Test (org.junit.Test)1 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)1 FinalPojo (org.mule.test.subtypes.extension.FinalPojo)1 HouseDoor (org.mule.test.subtypes.extension.HouseDoor)1 NoReferencePojo (org.mule.test.subtypes.extension.NoReferencePojo)1 ParentShape (org.mule.test.subtypes.extension.ParentShape)1 PojoForList (org.mule.test.subtypes.extension.PojoForList)1 Square (org.mule.test.subtypes.extension.Square)1 Triangle (org.mule.test.subtypes.extension.Triangle)1 VeganCookBook (org.mule.test.vegan.extension.VeganCookBook)1