For some small remarks on how to build the test, here is a portion of the code I used:
List<Home> homes = new ArrayList<Home>();This tells the mock that we expect the next method call of the proxied object (in this case a dao) to be of parameter findInPerimeter with the given parameters and to have a result of returnValue. manager uses this proxy to verify the call.
// set expected behavior on dao
mock.expects(once()).method("findInPerimeter").with(eq(center),
eq(radius / Constants.KM_PER_DEGREE)).will(returnValue(homes));
List<Home> result = manager.findInPerimeter(center, radius);
assertEquals(result, homes);
No comments:
Post a Comment