I have a Java method that looks something like this:
public Map<String <Set<Something>> mathod() {
Map<String, Set<Something>> originalMap = createMap();
return Utils.fixMap(originalMap);
}
I have a groovy/spock test and I need to test the method and I need to mock the Utils and make fixMap() return its input.
Originally, the Utils method was a service and it was mocked like this:
UtilService mock = Mock(UtilService) {
fixMap(_ as Map) >> { Map input -> return input }
}
I can't figure out how to do it. Please help, thanks in advance.