Search in sources :

Example 1 with Villain

use of org.mule.test.marvel.model.Villain in project mule by mulesoft.

the class NonBlockingOperationsTestCase method fireMissileAndAssert.

private void fireMissileAndAssert(String flowName) throws Exception {
    Villain villain = new Villain();
    String result = (String) flowRunner(flowName).withPayload(villain).run().getMessage().getPayload().getValue();
    assertThat(villain.isAlive(), is(false));
    assertThat(result, is(KABOOM));
}
Also used : MissileProofVillain(org.mule.test.marvel.model.MissileProofVillain) Villain(org.mule.test.marvel.model.Villain)

Example 2 with Villain

use of org.mule.test.marvel.model.Villain in project mule by mulesoft.

the class OperationReconnectionTestCase method defaultReconnection.

@Test
public void defaultReconnection() throws Exception {
    final Villain villain = new Villain();
    flowRunner("defaultReconnection").withPayload(villain).runExpectingException();
    assertThat(villain.isAlive(), is(true));
    IronMan stark = getIronMan();
    assertThat(stark.getMissilesFired(), is(1));
}
Also used : Villain(org.mule.test.marvel.model.Villain) IronMan(org.mule.test.marvel.ironman.IronMan) Test(org.junit.Test)

Example 3 with Villain

use of org.mule.test.marvel.model.Villain in project mule by mulesoft.

the class OperationReconnectionTestCase method operationReconnection.

@Test
public void operationReconnection() throws Exception {
    final Villain villain = new Villain();
    flowRunner("operationReconnection").withPayload(villain).run();
    assertThat(villain.isAlive(), is(false));
    IronMan stark = getIronMan();
    assertThat(stark.getMissilesFired(), is(2));
}
Also used : Villain(org.mule.test.marvel.model.Villain) IronMan(org.mule.test.marvel.ironman.IronMan) Test(org.junit.Test)

Example 4 with Villain

use of org.mule.test.marvel.model.Villain in project mule by mulesoft.

the class NonBlockingOperationsTestCase method failingNonBlockingConnectedOperation.

@Test
public void failingNonBlockingConnectedOperation() throws Exception {
    expectedException.expectFailingComponent(is(locator.find(Location.builder().globalName("fireMissile").addProcessorsPart().addIndexPart(1).build()).get()));
    expectedException.expectMessage(is(MISSILE_PROOF));
    expectedException.expectCause(instanceOf(UnsupportedOperationException.class));
    Villain villain = new MissileProofVillain();
    flowRunner("fireMissile").withPayload(villain).run();
    assertThat(villain.isAlive(), is(true));
}
Also used : MissileProofVillain(org.mule.test.marvel.model.MissileProofVillain) MissileProofVillain(org.mule.test.marvel.model.MissileProofVillain) Villain(org.mule.test.marvel.model.Villain) Test(org.junit.Test)

Aggregations

Villain (org.mule.test.marvel.model.Villain)4 Test (org.junit.Test)3 IronMan (org.mule.test.marvel.ironman.IronMan)2 MissileProofVillain (org.mule.test.marvel.model.MissileProofVillain)2