(What the online example didn't mention was that you can't use the same name
for the test case class as its filename - in that case I get a "Duplicate
class definition" error. I guess that is expected?)
Stack trace:
JUnit version 4.4
.E
Time: 0.016
There was 1 failure:
1) initializationError0(test.ArrayUtilTestCase)
java.lang.Exception: No runnable methods
at
org.junit.internal.runners.MethodValidator.validateInstanceMethods(MethodValidator.java:32)
at
org.junit.internal.runners.MethodValidator.validateMethodsForDefaultRunner(MethodValidator.java:43)
at
org.junit.internal.runners.JUnit4ClassRunner.validate(JUnit4ClassRunner.java:36)
at
org.junit.internal.runners.JUnit4ClassRunner.<init>(JUnit4ClassRunner.java:27)
--
View this message in context: http://www.nabble.com/JUnit4-and-%22No-runnable-methods%22-tp14796532p14796532.html
Sent from the groovy - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
Dave Syer wrote:
>
> I get an initialisation error from the test runner when I try and run a
> JUnit4 test case like in the examples online
> (http://groovy.codehaus.org/Using+JUnit+4+with+Groovy) - "No runnable
> methods". I have imported org.junit.Test and put @Test on one of the
> methods.
>
> (What the online example didn't mention was that you can't use the same
> name for the test case class as its filename - in that case I get a
> "Duplicate class definition" error. I guess that is expected?)
>
> Stack trace:
>
> JUnit version 4.4
> .E
> Time: 0.016
> There was 1 failure:
> 1) initializationError0(test.ArrayUtilTestCase)
> java.lang.Exception: No runnable methods
> at
> org.junit.internal.runners.MethodValidator.validateInstanceMethods(MethodValidator.java:32)
> at
> org.junit.internal.runners.MethodValidator.validateMethodsForDefaultRunner(MethodValidator.java:43)
> at
> org.junit.internal.runners.JUnit4ClassRunner.validate(JUnit4ClassRunner.java:36)
> at
> org.junit.internal.runners.JUnit4ClassRunner.<init>(JUnit4ClassRunner.java:27)
>
>
I have the same error,there is any options?
--
View this message in context: http://www.nabble.com/JUnit4-and-%22No-runnable-methods%22-tp14796532p21113104.html
Sent from the groovy - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
if you have the same problem could you please first do the following
things: tell us which version of Groovy you use. And give us please a
simple testcase, that reproduces the problem.
then we can tell much more
bye blackdrag
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/
I hope it is useful.
Jochen Theodorou wrote:
> pfew... this thread was started nearly a year ago...
>
> if you have the same problem could you please first do the following
> things: tell us which version of Groovy you use. And give us please a
> simple testcase, that reproduces the problem.
>
> then we can tell much more
>
> bye blackdrag
>
>
JUnit 4.5
Groovy 1.5.6
Test case is
import org.junit.Test
public class MathTest {
@Test public void firstTest(){
println("Test")
}
}
I use maven and Intellij to try it both give me the same No runnable Method
error
--
View this message in context: http://www.nabble.com/JUnit4-and-%22No-runnable-methods%22-tp14796532p21333168.html
Sent from the groovy - user mailing list archive at Nabble.com.
--
View this message in context: http://www.nabble.com/JUnit4-and-%22No-runnable-methods%22-tp14796532p21333384.html
I'm experimenting with Groovy mixins and hit a wall with the following
scenario. I'm sure I'm doing something wrong and hope that you might be
able to tell me the way out.
class A {
def final foo() {
bar()
}
private final String bar() {
return "Bar"
}
}
class B extends A {}
class C {}
C.metaClass {
mixin B
}
def c= new C()
c.foo()
Running the script results in "Caught:
groovy.lang.MissingMethodException: No signature of method: C.bar() is
applicable for argument types: () values: {}". Changing the bar's
visibility to non-private or mixing in A instead of B helps here.
I assume the problem is that bar() is not directly visible in B, but
since I'm calling bar() from foo(), which is defined in A, I would
expect the code to work.
Am I right that calling private methods (bar) from inherited mixed-in
methods (foo) is not possible?
Vaclav
I would say this is a bug. If mixing in A works, then mixing in B should
work too.
> I assume the problem is that bar() is not directly visible in B, but
> since I'm calling bar() from foo(), which is defined in A, I would
> expect the code to work.
I guess the implementation is doing nasty things with "this"
bye blackdrag
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/
here's one more little issue that puzzled my head. It might be somewhat
related to http://jira.codehaus.org/browse/GROOVY-3266.
class Parent {
private String myPrivateProperty="secret"
public final void foo() {
[1, 2, 3].each {
println myPrivateProperty
}
}
}
class Child extends Parent {}
new Child().foo()
This script throws:
Caught: groovy.lang.MissingPropertyException: No such property:
myPrivateProperty for class: Child
Changing visibility of myPrivateProperty to non-private or instantiating
Parent instead of Child makes the script run just fine. I wonder whether
this behavior is intentional or not.
Regards,
It is a bug, it is already reported and it is an annoying thing. It is
not intended to work like this. A workaround is:
public final void foo() {
def x = myPrivateProperty
[1, 2, 3].each {
println x
}
}
but of course that does not satisfy all needs.
bye blackdrag
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/
Vaclav
thank you for clarification as well as for the workaround. That should
help in my case.
Vaclav
Jochen Theodorou wrote:
>
> It is a bug, it is already reported and it is an annoying thing. It is
> not intended to work like this. A workaround is:
>
> public final void foo() {
> def x = myPrivateProperty
> [1, 2, 3].each {
> println x
> }
> }
>
> but of course that does not satisfy all needs.
>
> bye blackdrag
>
Vaclav
I didnt look at the issue, but no, I don't think it is related