Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.1-rc-2
-
None
-
None
Description
I want to use MockFor for testing that, in the case of certain start up parameter combination, a certain point in a startup script of my application is not reached, . This point is defined by a call to a method of a particular class. To check this I do:
MockFor mockForX = new MockFor(X)
mockForX.demand.myMethod(0..0)
mockForX.use {
Main.main(args)
}
This works, i.e. an AssertionFailedException is thrown, if during the processing of the main method, X.myMethod is called. The problem is, that an AssertionFailedException is also thrown, if X.myMethod is not called. It say the following:
junit.framework.AssertionFailedError: verify[0]: expected 0..0 call(s) to 'myMethod' but was never called.
A work around I see is to make use of the fact that in Groovy the main method might return an argument.
I might be able and have time to submit a patch tomorrow.