After a happy couple of weeks, the method I had written about here started to fall apart, at least in acceptance tests.
The issue was that in some acceptance tests, the Geb framework was using
java.util.Calendar internally, and now as the Calendar was stubbed globally, it wasn’t working correctly anymore.
Thankfully, this issue was easily solved with a layer of redirection: I modified my code to use a “utils” class to access Calendar, and then when need be I stubbed the utils class instead.
1 2 3 4 5 6