public class MyService {
private Dependency dependency;
public MyService(Dependency dependency) {
this.dependency = dependency;
}
public String doSomething() {
return dependency.getValue();
}
}
public interface Dependency {
String getValue();
}
<config>
<mocks>
<mock>
<class>com.example.DependencyImpl</class>
<behavior>
<method name="getValue">
<return>Mocked Value</return>
</method>
</behavior>
</mock>
</mocks>
</config>