コード例 #1
0
  @Test
  public void testEventHierarchyTrigger() {
    registerEvents();

    Object event = new Object();
    eventManager.trigger(event);

    assertNull(target.getEvent());
    assertEquals(event, target.getObjectEvent());
  }
コード例 #2
0
  @Test
  public void testUnregister() {
    TargetEventTriggered trigger = new TargetEventTriggered();
    eventManager.register(ObservesEvent.class, trigger);
    eventManager.unregister(trigger);

    eventManager.trigger(new ObservesEvent());

    assertFalse(trigger.isTriggered());
  }
コード例 #3
0
  @Test
  public void testRegistration() {
    registerEvents();

    ObservesEvent event = new ObservesEvent();
    eventManager.trigger(event);

    assertEquals(event, target.getEvent());
    assertEquals(event, target.getObjectEvent());
  }