class EntityManagerFactoryDecorator implements TestClassDecorator {

    @Override
    public void beforeAll(final TestInvocation invocation) throws Exception {
        ExecutionContext context = invocation.getContext();
        final PersistenceUnitDescriptor descriptor = context.getDescriptor();

        final EntityManagerFactory emf = Persistence.createEntityManagerFactory(descriptor.getUnitName(), descriptor.getProperties());
        context.storeData(Constants.KEY_ENTITY_MANAGER_FACTORY, emf);
    }

}