use of org.mule.test.heisenberg.extension.model.CarDealer in project mule by mulesoft.
the class OperationExecutionTestCase method abstractParameterWithSubtypesAndParameterGroup.
@Test
public void abstractParameterWithSubtypesAndParameterGroup() throws Exception {
Investment investment = (Investment) flowRunner("investment").run().getMessage().getPayload().getValue();
assertThat(investment, is(instanceOf(CarWash.class)));
CarWash carWash = (CarWash) investment;
assertThat(carWash.getCommercialName(), is("A1"));
assertThat(carWash.getInvestmentInfo(), is(notNullValue()));
assertThat(carWash.getInvestmentInfo().getValuation(), equalTo(100L));
assertThat(carWash.getCarsPerMinute(), is(5));
assertThat(carWash.isApproved(), is(true));
assertThat(carWash.getInvestmentSpinOffs(), is(notNullValue()));
assertThat(carWash.getInvestmentSpinOffs().get("other-car-wash"), is(instanceOf(CarWash.class)));
CarWash spinOff = (CarWash) carWash.getInvestmentSpinOffs().get("other-car-wash");
assertThat(spinOff.getCommercialName(), is("B1"));
assertThat(spinOff.getInvestmentInfo(), is(notNullValue()));
assertThat(spinOff.getInvestmentInfo().getValuation(), equalTo(10L));
assertThat(spinOff.getCarsPerMinute(), is(1));
assertThat(spinOff.getDiscardedInvestments(), is(notNullValue()));
assertThat(spinOff.getDiscardedInvestments().size(), is(1));
assertThat(spinOff.getDiscardedInvestments().get(0), is(instanceOf(CarDealer.class)));
CarDealer discarded = (CarDealer) spinOff.getDiscardedInvestments().get(0);
assertThat(discarded.getCommercialName(), is("Premium Cars"));
assertThat(discarded.getCarStock(), is(50));
assertThat(discarded.getInvestmentInfo(), is(notNullValue()));
assertThat(discarded.getInvestmentInfo().getValuation(), equalTo(666L));
assertThat(discarded.getInvestmentInfo().getInvestmentPlanB(), is(instanceOf(CarDealer.class)));
CarDealer planB = (CarDealer) discarded.getInvestmentInfo().getInvestmentPlanB();
assertThat(planB.getCommercialName(), is("Not So Premium Cars"));
assertThat(planB.getCarStock(), is(5));
assertThat(planB.getInvestmentInfo(), is(notNullValue()));
assertThat(planB.getInvestmentInfo().getValuation(), equalTo(333L));
}
Aggregations