@Test
  public void testUnregister() {
    final MockCountingObserver aGlobal = new MockCountingObserver();
    assertTrue(ScopedEventManager.registerObserver(EScope.GLOBAL, aGlobal).isChanged());
    assertTrue(ScopedEventManager.unregisterObserver(EScope.GLOBAL, aGlobal).isChanged());

    // unregister again should fail :)
    assertTrue(ScopedEventManager.unregisterObserver(EScope.GLOBAL, aGlobal).isUnchanged());
  }
  @Test
  public void testScoping() {
    // prepare processing
    final MockCountingObserver aGlobal = new MockCountingObserver();
    final MockCountingObserver aApp = new MockCountingObserver();
    final MockCountingObserver aRequest = new MockCountingObserver();
    assertTrue(ScopedEventManager.registerObserver(EScope.GLOBAL, aGlobal).isChanged());
    assertTrue(ScopedEventManager.registerObserver(EScope.APPLICATION, aApp).isChanged());
    assertTrue(ScopedEventManager.registerObserver(EScope.REQUEST, aRequest).isChanged());
    try {
      // check preconditions
      assertEquals(0, aGlobal.getInvocationCount());
      assertEquals(0, aApp.getInvocationCount());
      assertEquals(0, aRequest.getInvocationCount());

      // process
      assertTrue(ScopedEventManager.notifyObservers(new BaseEvent(MockCountingObserver.TOPIC)));

      // check postconditions
      assertEquals(1, aGlobal.getInvocationCount());
      assertEquals(1, aApp.getInvocationCount());
      assertEquals(1, aRequest.getInvocationCount());
    } finally {
      // unregister
      assertTrue(ScopedEventManager.unregisterObserver(EScope.GLOBAL, aGlobal).isChanged());
      assertTrue(ScopedEventManager.unregisterObserver(EScope.APPLICATION, aApp).isChanged());
      assertTrue(ScopedEventManager.unregisterObserver(EScope.REQUEST, aRequest).isChanged());
    }
  }