Powermock and Spring cause ConversionException when injecting EntityManager in test

I had a similar issue and it was suggested to me to create a Resources.java class that Produced an Entity Manager.

@Stateful
public class Resources implements Serializable {

    @PersistenceContext (type = PersistenceContextType.TRANSACTION)
    private EntityManager entityManager;

    @Produces
    public EntityManager getEntityManager() {
        return entityManager;
    }

}

I’m still not exactly sure why this solution worked for me… but it did.

v/r
Ace

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)