mock « Test « JPA Q&A





1. How can I access private class members in Java?    stackoverflow.com

I have data model classes that contain private fields which are meant to be read-only (via a getter function). These fields are set by my JPA persistence provider (eclipselink) during normal ...

2. How to test a null value for easy Mock Hibernate criterion?    stackoverflow.com

I want to test this value with Easy Mock but am unable to generate anything for this. I keep getting this error java.lang.AssertionError:
Unexpected method call add(version is null): This is ...

3. populating mock objects for testing    forum.hibernate.org

What I do to test hibernate mappings is create a test database, with a certain set of test data, then write tests that start a transaction at the beginning of the test then rollback at the end. In the test, I can to get, find, save, delete, etc., assert the objects returned from the hibernate DAO methods are correct, and then ...

4. "Classic" Sessions causing mock testing problems    forum.hibernate.org

context.checking(new Expectations() {{ one (mockFactory).getCurrentSession(); // expect getCurrentSession() to be called on mock SessionFactory will(returnValue(mockSession)); // force mock SessionFactory to return mock Session one (mockSession).load("Foo", "fooId"); // expect load(...) to be called on mock Session ...