को अपग्रेड करने के बाद विफल होने वाले निजी तरीकों के साथ Grails स्पॉक परीक्षण हमने Grail 2.4.4 से 2.5.0 तक हमारे ऐप को अपग्रेड कर दिया है। सभी ठीक काम कर रहे हैं, लेकिन कुछ परीक्षण मामले विफल रहे हैं जिनमें कुछ निजी तरीके शामिल हैं।2.5.0
import org.junit.Before
class UserServiceSpec extends IntegrationSpec {
@Before
def setup() {
// Some initialization
}
// being used in other test methods
private void getParams() {
// some code
}
void testUserUniqueEmali() {
when: "this runs"
// code
then: "hello"
// code
}
}
अपवाद फेंक दिया:
java.lang.IllegalAccessException: Class org.spockframework.util.ReflectionUtil can not access a member of class com.test.UserServiceSpec with modifiers "private"
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:153)
at org.spockframework.runtime.model.MethodInfo.invoke(MethodInfo.java:84)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at _GrailsTest.run_closure1(_GrailsTest.groovy:102)
at TestApp.run_closure1(TestApp.groovy:32)
मैं निर्भरता रिपोर्ट बनाई और यहाँ कुछ आँकड़े हैं:
org.spockframework:spock-core:1.0-groovy-2.4
org.codehaus.groovy:groovy-all:2.4.3
यह दिखाता है कि स्पॉक ढांचे के नवीनतम संस्करण को इस्तेमाल किया जा रहा है, लेकिन मैं मैं इस समस्या को ठीक करने में सक्षम नहीं हूँ। मैंने "निजी" संशोधक को हटाने का प्रयास किया है, लेकिन यह अभी भी काम नहीं कर रहा है।
जेडजेड 5 का जवाब बताता है कि क्या हो रहा है –