Example #1
0
  /**
   * {@link PostConstruct} test.
   *
   * @throws ManagerException
   */
  @Test
  public void postConstructTest() throws ManagerException {
    // saving initial state
    final int currentValue = SampleServiceImpl.getPostConstructedAcount();

    Manager.register(SampleService.class, SampleServiceFactory.class);
    Manager.warmUp();
    Assert.assertEquals(currentValue + 2, SampleServiceImpl.getPostConstructedAcount());
  }
Example #2
0
  /**
   * {@link PreDestroy} test.
   *
   * @throws ManagerException
   */
  @Test
  public void preDestroyTest() throws ManagerException {
    // saving initial state
    final int currentValue = SampleServiceImpl.getPreDestroyedAcount();

    Manager.register(SampleService.class, SampleServiceFactory.class);
    Manager.get(SampleService.class); // force initialization
    Manager.tearDown();
    Assert.assertEquals(currentValue + 2, SampleServiceImpl.getPreDestroyedAcount());
  }