@Bean
        public EntityManagerFactory testEntityManagerFactory() {
            val factory = mock(DummyEntityManagerFactory.class);
            when(factory.getPersistenceUnitName()).thenReturn("DummyUnit");
            when(factory.createEntityManager()).thenReturn(mock(EntityManager.class));
            return factory;
        }
This is {@link JpaPersistenceUnitProviderTests}.

@author Misagh Moayyed
@since 7.0.0
support/cas-server-support-jpa-util/src/test/java/org/apereo/cas/configuration/support/JpaPersistenceUnitProviderTests.java