A better alternative is to use an argument T witnAny(T arg):
new Expectations() {{
UrlService.addUrls(withAny(new ArrayList<String>()));
result = expectedCandidates;
}};
Or, to disable code verification locally if your IDE supports it. With IntelliJ I can write:
new Expectations() {{
UrlService.addUrls((List<String>) any);
result = expectedCandidates;
}};
... this is really normal. Code checks are good and that’s all, but there are always exceptional situations when you can turn them off.
source
share