I am trying to mock a Java method with multiple arguments. One of the arguments is a String. The String can take on many values while my program is running, but it may not be null or blank (it must contain at least one non-whitespace character).
Using anyString() is insufficient here. What is a good way to mock a method like MyClass.bar() (shown below)?
public class MyClass {
public Foo bar(String str, int myInt) {
assert(!str.isBlank());
return new Foo(str, myInt);
}
}
Sorry, the example is contrived - only for illustration purposes.