EntityManagerProducerProxy implements Producer<EntityManager> { @Override public void dispose(final EntityManager instance) { ((Disposable) instance).dispose(); } EntityManagerProducerProxy(final Producer<EntityManager> proxied); @Override EntityManager produce(final CreationalContext<EntityManager> ctx); @Override void dispose(final EntityManager instance); @Override Set<InjectionPoint> getInjectionPoints();  }
@Test(expected = ClassCastException.class) public void testStandAloneEntityManagerDispose() { final EntityManagerProducerProxy producer = new EntityManagerProducerProxy(delegate); producer.dispose(mock(EntityManager.class)); }