Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-1
-
Fix Version/s: 1.0-beta-6
-
Component/s: None
-
Labels:None
-
Environment:Mac OS X running JDK 1.4.1 and CVS HEAD from Tue Oct 28 20:26:26 EST 2003
-
Number of attachments :
Description
The following test case:
class SystemPrintlnTest extends GroovyTestCase {
void testPrintHelloWorld()
{ println("Hello World") }}
Fails with:
[mccallister@kite ~/src/groovy]$maven test:single -Dtestcase=SystemPrintlnTest
... compilation deleted ...
test:single:
[junit] Running SystemPrintlnTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 1.617 sec
[junit] Testsuite: SystemPrintlnTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 1.617 sec
[junit]
[junit] Testcase: testPrintHelloWorld took 0.064 sec
[junit] Caused an ERROR
[junit] failed to invoke method: public static void org.codehaus.groovy.runtime.DefaultGroovyMethods.println(java.lang.Object) on: null with arguments: [testPrintHelloWorld(SystemPrintlnTest), 'Hello World'] reason: java.lang.IllegalArgumentException: wrong number of arguments
[junit] org.codehaus.groovy.runtime.InvokerException: failed to invoke method: public static void org.codehaus.groovy.runtime.DefaultGroovyMethods.println(java.lang.Object) on: null with arguments: [testPrintHelloWorld(SystemPrintlnTest), 'Hello World'] reason: java.lang.IllegalArgumentException: wrong number of arguments
[junit] at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:618)
[junit] at groovy.lang.MetaClass.invokeMethod(MetaClass.java:217)
[junit] at groovy.lang.MetaClass.invokeMethod(MetaClass.java:182)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:591)
[junit] at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:579)
[junit] at groovy.lang.MetaClass.invokeMethod(MetaClass.java:203)
[junit] at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:101)
[junit] at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:77)
[junit] at SystemPrintlnTest.invokeMethod(/Users/mccallister/src/groovy/target/test-classes/groovy/SystemPrintlnTest.groovy)
[junit] at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:87)
[junit] at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:77)
[junit] at SystemPrintlnTest.testPrintHelloWorld(/Users/mccallister/src/groovy/target/test-classes/groovy/SystemPrintlnTest.groovy:4)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] Caused by: java.lang.IllegalArgumentException: wrong number of arguments
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:591)
[junit] ... 29 more
[junit]
[junit] Testcase: testPrintHelloWorld
BUILD FAILED
File...... file:/Users/mccallister/.maven/plugins/maven-test-plugin-1.4/
Element... junit
Line...... 193
Column.... 43
Test SystemPrintlnTest failed
Total time: 44 seconds
Finished at: Tue Oct 28 20:25:08 EST 2003
[mccallister@kite ~/src/groovy]$
Patch to fix this problem. Not sure if it is the route you want to take as it doesn't know anything about string interpolation of the form "hello $
{world}" but it does let the println("Hello World") pass.