I have a class in src/groovy
like this
class MyClass {
@AutoWired
SomeOtherClass someOtherClass
String test() {
return someOtherClass.testMethod()
}
}
When I write a test for this method I am getting an error: Cannot invoke method testMethod() on null object
This is my test
def "test test" () {
expect:
myClass.test() == "somevalue"
}
What am I doing wrong? Is there a way to mock the @AutoWired
class?
Aucun commentaire:
Enregistrer un commentaire