Hi,
I'm testing the parameter passed to a mocked method but I'm seeing strange results.
My production class is Java, here's a snippet:
void process(List<String[]> rows) {
List<String[]> errors = new ArrayList<String[]>();
// business logic
customerRecordErrorService.write(errors);
}
in my Spock test, I want to verify the contents of errors. The first case is no errors so I'm expecting a List<String[]> with no elements.
1 * customerRecordErrorService.write(_) >> { errors ->
assert errors.size() == 0
}
This fails with:
Condition not satisfied:
errors.size() == 0
| | |
[[]] 1 false
From what I can tell I'm getting a List with one element and that element is the List<String[]> I need. Why is this?
Thanks
Rakesh