In a test class named MyTest, I call
MyTest.getResourceAsStream
Codenarc marks this as a CoupledTestCase error, but this isn't coupled to another test case, it is simply using the current class' name.
Available in CodeNarc 0.19
I just recently upgraded to 0.19. This bug still exists.
Hmmmm, that is weird.
This, for instance, is the test case that now passes with no violations:
class MyTest extends GroovyTestCase { void testMethod() { def input = MyTest.getResourceAsStream('sample.txt') } }
Can you paste in the code that exhibits the error?
This does it:
package com.sample
import org.junit.Test
class MyTest {
@Test void "this is the test"() { MyTest.getResourceAsStream("somefile").text }
}
What I noticed is that it does not happen if the class is in the default package. If an explicit package is specified, then it happens.
Yup, that was it -- the bug fix only works for classes in the default package. Okay, we'll get this fixed.
thanks
Log in to post a comment.
Available in CodeNarc 0.19
I just recently upgraded to 0.19. This bug still exists.
Hmmmm, that is weird.
This, for instance, is the test case that now passes with no violations:
Can you paste in the code that exhibits the error?
This does it:
package com.sample
import org.junit.Test
class MyTest {
}
What I noticed is that it does not happen if the class is in the default package. If an explicit package is specified, then it happens.
Yup, that was it -- the bug fix only works for classes in the default package. Okay, we'll get this fixed.
thanks