mardi 30 août 2016

Mockito: error mocking persistence?

I am getting a null pointer exception at the following line when trying to set up Junit Tests:

private final EntityManagerFactory factory;

    public EntityManagerProvider( Config config, String persistenceUnit) {
        this.factory = Persistence.createEntityManagerFactory(persistenceUnit,
                                                              config.getDbProperties());
    }

Is there a way that I can mock the return value of Persistence.createEntityManagerFactory ?

Aucun commentaire:

Enregistrer un commentaire