0 Replies Latest reply on Jan 19, 2006 5:43 PM by emsa

    Mocking the EntityManager

    emsa

      [For background see the last few posts of http://www.jboss.com/index.html?module=bb&op=viewtopic&t=70308 ]


      "gavin.king@jboss.com" wrote:
      Well, the thing is, if you run inside MC, you would have to mock out the EM *inside* the MC. This is very easy to do with a plain MC, but not really with EEJB.
      I would try asking in the EJB3 forum, perhaps I am missing something.


      Hi, I would like to mock the EntityManager to be able to preform tests-cases without actually accessing the database. So basically I would like "@PersistenceContext" to inject my mocked EM and not the default EM. I have tried to inject/replace the EM by hand using some reflection but it seems like an impossible path since in the general case all objects are Proxys of one kind or another (this playing with Seam).

      Any ideas or comments?

      Thanks,
      /Magnus