Using groovy, I need to test a Java method. For example Foo.needsTesting(); Near the top of the needsTesting method is a call that sets an Object using a static call to a Factory method. For example ...
class Foo {
public static String needsTesting() {
FooStructure data = FooFactory.getData(); // Static Java method, does not work in groovy test bed environment ...
... more code ...
return answer;
}
}
Is there a way in groovy, without touching the source for either Foo.java or FooFactory.java or FooStructure.java to interception the call FooFactory.getData() so as to test with desired data?