@Test
 public void testInstance(Consumer consumer) throws Throwable {
   Instance<Cow> instance = consumer.getCow();
   Instance<Cow> instance1 = Utils.deserialize(Utils.serialize(instance));
   Assert.assertTrue(checkInstance(instance1));
   Assert.assertTrue(checkEquality(instance, instance1));
 }
 @Test
 public void testEvent(Consumer consumer, CowEventObserver observer) throws Throwable {
   Event<Cow> event = consumer.getEvent();
   Event<Cow> event1 = Utils.deserialize(Utils.serialize(event));
   Assert.assertTrue(checkEvent(event1, observer));
   Assert.assertTrue(checkEquality(event, event1));
 }
 @Test
 public void testMethodInjectionPoint(MethodInjectionPointConsumer consumer) throws Throwable {
   Dog.reset();
   consumer.ping();
   InjectionPoint injectionPoint = Dog.getInjectionPoint();
   InjectionPoint injectionPoint1 = Utils.deserialize(Utils.serialize(injectionPoint));
   Assert.assertTrue(checkInjectionPoint(injectionPoint1, MethodInjectionPointConsumer.class));
   Assert.assertTrue(checkEquality(injectionPoint, injectionPoint1));
 }
 @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);
  }
 @Test
 public void testBeanManagerBean(BeanManager beanManager) throws Throwable {
   BeanManager beanManager1 = Utils.deserialize(Utils.serialize(beanManager));
   Assert.assertTrue(checkBeanManager(beanManager1));
   Assert.assertTrue(checkEquality(beanManager, beanManager1));
 }
 @Test
 public void testUserTransactionBean(UserTransaction userTransaction) throws Throwable {
   UserTransaction userTransaction1 = Utils.deserialize(Utils.serialize(userTransaction));
   Assert.assertTrue(checkUserTransaction(userTransaction1));
 }
 @Test
 @Category({Integration.class, Broken.class})
 public void testPrincipal(Principal principal) throws Throwable {
   Principal principal1 = Utils.deserialize(Utils.serialize(principal));
   Assert.assertTrue(checkPrincipal(principal1));
 }
 @Test
 public void testDefaultValidatorFactoryBean(ValidatorFactory validatorFactory) throws Throwable {
   ValidatorFactory validatorFactory1 = Utils.deserialize(Utils.serialize(validatorFactory));
   Assert.assertTrue(checkValidatorFactory(validatorFactory1));
 }
 @Test
 public void testDefaultValidatorBean(Validator validator) throws Throwable {
   Validator validator1 = Utils.deserialize(Utils.serialize(validator));
   Assert.assertTrue(checkValidator(validator1));
 }
 @Test
 public void testAllOnBean(Consumer consumer) throws Throwable {
   consumer.check();
   Consumer consumer1 = Utils.deserialize(Utils.serialize(consumer));
   consumer1.check();
 }