JpaUnitCdiExtension implements Extension { public <T> void registerProducer(@Observes final ProcessProducer<T, EntityManager> pb) { pb.setProducer(new EntityManagerProducerProxy(pb.getProducer())); }  void registerProducer(@Observes final ProcessProducer<T, EntityManager> pb);  }
@Test public void testRegisterProducer() { final JpaUnitCdiExtension extension = new JpaUnitCdiExtension(); extension.registerProducer(producer); verify(producer).getProducer(); verify(producer).setProducer(producerCaptor.capture()); verifyNoMoreInteractions(producer); final Producer<EntityManager> captured = producerCaptor.getValue(); assertThat(captured, not(nullValue())); assertThat(captured, instanceOf(EntityManagerProducerProxy.class)); }