Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.5.6, 1.7.0
-
None
-
None
-
Windows XP, Eclipse Ganymede, Groovy Eclipse plugin using Groovy 1.5.6
Description
Here's an example of a simple test, in which the return type of a Private Static Method within a Class is needed to return a String different from what it would normally return:
void testCheckSunrise(){ WeatherMonitor.metaClass.static.findSunriseTime = {-> '5:57 AM'} WeatherMonitor testSubject = new WeatherMonitor() assertEquals('5:57 AM', testSubject.sunrise) }
And here is the Class itself:
public class WeatherMonitor { def getSunrise(){ findSunriseTime() } private static findSunriseTime(){ '7:15 AM' } }
The result of the test execution is always '7:15 AM' and so the test will always fail. This would be a great help in Unit Testing techniques, especially Test Driven Development in Groovy.
It would be great to see Groovy have this capability.