Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.8.6
-
Fix Version/s: None
-
Component/s: groovy-jdk
-
Labels:None
-
Number of attachments :
Description
Due to dynamic typing nature of Groovy, there is no way currently for a unit test using a Demand object through MockFor to assert that the method being mocked is actually on the real implementation class or interface. This feature could manifest itself as a overloaded method on the Demand object.
myServiceMock.demand.doSomething(1..1, true)
{ String param1, List param2 -> }The second parameter on the doSomething method would trigger a verification on the original intercepted Class, ensuring that the method signature can be found on this Class. This feature would aid in refactoring Groovy code that incorporate unit tests using MockFor isolation. If the method was removed, added or lost parameters, the Demand verification feature would detect the change and notify the developer via an assertion exception being thrown. This feature would default to inactive so existing code would not break.
I blogged about this feature at http://bartling.blogspot.com/2012/05/potential-issue-when-mocking-in-groovy.html.