@Test
public void testApplyEntityManagerFactoryInjection() throws Throwable {

    // GIVEN
    final Field field = getClass().getDeclaredField("emf");
    when(ctx.getPersistenceField()).thenReturn(field);
    final PersistenceUnitDecorator fixture = new PersistenceUnitDecorator();
    // WHEN
    fixture.beforeTest(invocation);
    // THEN
    assertThat(emf, equalTo(entityManagerFactory));
    verify(entityManagerFactory, times(0)).createEntityManager();
    verify(entityManagerFactory, times(0)).close();
}