@Test
 public void testDestroyDoesntTryToRemoveSLSB() {
   Bean<BeanLocal> bean = Utils.getBean(beanManager, BeanLocal.class);
   Assert.assertNotNull("Expected a bean for stateless session bean BeanLocal", bean);
   CreationalContext<BeanLocal> creationalContext = beanManager.createCreationalContext(bean);
   BeanLocal instance = bean.create(creationalContext);
   bean.destroy(instance, creationalContext);
 }
 @Test
 public void test() {
   FooDisposer.reset();
   FooProducer.reset();
   Bean<Foo> bean = Utils.getBean(beanManager, Foo.class);
   CreationalContext<Foo> ctx = beanManager.createCreationalContext(bean);
   Foo instance = bean.create(ctx);
   Assert.assertEquals("foo!", instance.getBlah());
   bean.destroy(instance, ctx);
   Assert.assertFalse(FooDisposer.isDisposed());
   Assert.assertTrue(FooProducer.isDisposed());
 }
  /**
   * When the create() method of a Bean object that represents a stateful session bean that is
   * called, the container creates and returns a session bean proxy, as defined in Section 3.3.9,
   * "Session bean proxies".
   */
  @Test
  public void testCreateSFSB(GrossStadt frankfurt) {
    Bean<KleinStadt> stadtBean = Utils.getBean(beanManager, KleinStadt.class);
    Assert.assertNotNull("Expected a bean for stateful session bean Kassel", stadtBean);
    CreationalContext<KleinStadt> creationalContext = new MockCreationalContext<KleinStadt>();
    KleinStadt stadtInstance = stadtBean.create(creationalContext);
    Assert.assertNotNull("Expected instance to be created by container", stadtInstance);
    Assert.assertTrue(
        "PostConstruct should be invoked when bean instance is created",
        frankfurt.isKleinStadtCreated());
    frankfurt.resetCreatedFlags();

    // Create a second one to make sure create always does create a new session bean
    KleinStadt anotherStadtInstance = stadtBean.create(creationalContext);
    Assert.assertNotNull("Expected second instance of session bean", anotherStadtInstance);
    Assert.assertTrue(frankfurt.isKleinStadtCreated());
    Assert.assertNotSame(
        "create() should not return same bean as before", anotherStadtInstance, stadtInstance);

    // Verify that the instance returned is a proxy by checking for all local interfaces
    Assert.assertTrue(stadtInstance instanceof KleinStadt);
    Assert.assertTrue(stadtInstance instanceof SchoeneStadt);
  }