I wrote few junits, using some mocking techniques. But stucked here:
public class Lookup {
private LookupMethod lookupMethod;
private interface LookupMethod {
String lookup(String input);
}
public String treatString(@Nullable String input) {
...
String lookupResult = lookupMethod.lookup(lookupInput);
...
}
}
I'm unit testing the treatString() method and looking how to mock the lookupMethod.lookup() call in the treatString() method above. I can't change Lookup class.
I'll appreciate a tip (example would be even better).