Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.5.6, 1.7.0
-
Fix Version/s: 1.8.x
-
Component/s: None
-
Labels:None
-
Environment:Windows XP, Eclipse Ganymede, Groovy Eclipse plugin using Groovy 1.5.6
-
Number of attachments :
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.
add code tags