Search in sources :

Example 1 with SubTypesMappingConnector

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

the class SubTypesMappingParserTestCase method configRetriever.

@Test
public void configRetriever() throws Exception {
    CoreEvent responseEvent = flowRunner("configRetriever").withPayload("").run();
    assertThat(responseEvent.getMessage().getPayload().getValue(), instanceOf(SubTypesMappingConnector.class));
    SubTypesMappingConnector payload = (SubTypesMappingConnector) responseEvent.getMessage().getPayload().getValue();
    assertThat(payload.getAbstractShape(), instanceOf(Square.class));
    assertThat(payload.getAbstractShape().getArea(), is(1));
    assertThat(payload.getExplicitSquare(), instanceOf(Square.class));
    assertThat(payload.getExplicitSquare().getArea(), is(4));
    assertThat(payload.getDoorInterface(), instanceOf(CarDoor.class));
    assertThat(payload.getFinalPojo(), instanceOf(FinalPojo.class));
    assertThat(payload.getRicin(), instanceOf(Ricin.class));
    assertThat(payload.getTriangle(), instanceOf(Triangle.class));
    assertThat(payload.getOnePojos(), is(notNullValue()));
    assertThat(payload.getOnePojos(), hasSize(1));
    assertThat(payload.getOnePojos().get(0), instanceOf(PojoForList.class));
    assertThat(payload.getOnePojos().get(0).getId(), is("inner"));
    assertThat(payload.getWeapons(), is(notNullValue()));
    assertThat(payload.getWeapons(), hasSize(4));
    assertRevolver(payload.getWeapons().get(0), 6);
    assertRicin(payload.getWeapons().get(1), 10L, "Krazy-8");
    assertRicin(payload.getWeapons().get(2), 20L, "Lidia");
    assertRevolver(payload.getWeapons().get(3), 0);
    assertThat(payload.getWeaponMap(), is(notNullValue()));
    assertThat(payload.getWeaponMap().entrySet(), hasSize(3));
    assertRicin(payload.getWeaponMap().get("ricinChild"), 20L, "Lidia");
    assertRevolver(payload.getWeaponMap().get("revolverChild"), 1);
    assertRevolver(payload.getWeaponMap().get("revolverMEL"), 0);
}
Also used : PojoForList(org.mule.test.subtypes.extension.PojoForList) SubTypesMappingConnector(org.mule.test.subtypes.extension.SubTypesMappingConnector) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Ricin(org.mule.test.heisenberg.extension.model.Ricin) FinalPojo(org.mule.test.subtypes.extension.FinalPojo) Triangle(org.mule.test.subtypes.extension.Triangle) Square(org.mule.test.subtypes.extension.Square) CarDoor(org.mule.test.subtypes.extension.CarDoor) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)1 Ricin (org.mule.test.heisenberg.extension.model.Ricin)1 CarDoor (org.mule.test.subtypes.extension.CarDoor)1 FinalPojo (org.mule.test.subtypes.extension.FinalPojo)1 PojoForList (org.mule.test.subtypes.extension.PojoForList)1 Square (org.mule.test.subtypes.extension.Square)1 SubTypesMappingConnector (org.mule.test.subtypes.extension.SubTypesMappingConnector)1 Triangle (org.mule.test.subtypes.extension.Triangle)1