Search in sources :

Example 1 with ProductionCreatedEvent

use of limelight.model.events.ProductionCreatedEvent in project limelight by slagyr.

the class JavaProductionTest method illuminatingTheProductionWithAction.

@Test
public void illuminatingTheProductionWithAction() throws Exception {
    writeSamplePlayerTo(fs.outputStream("/testProduction/classes/SamplePlayer.class"));
    fs.createTextFile("/testProduction/production.xml", "<production classpath='classes' class='SamplePlayer'><onProductionCreated>sampleAction</onProductionCreated></production>");
    production.illuminate();
    final JavaPlayer player = (JavaPlayer) production.getPlayer();
    final List<EventAction> onCreatedActions = production.getEventHandler().getActions(ProductionCreatedEvent.class);
    assertEquals(1, onCreatedActions.size());
    new ProductionCreatedEvent().dispatch(production);
    assertEquals(1, player.getPlayerClass().getField("invocations").get(lastSamplePlayer(player)));
}
Also used : EventAction(limelight.events.EventAction) ProductionCreatedEvent(limelight.model.events.ProductionCreatedEvent) Test(org.junit.Test)

Aggregations

EventAction (limelight.events.EventAction)1 ProductionCreatedEvent (limelight.model.events.ProductionCreatedEvent)1 Test (org.junit.Test)1