TDD to the rescue. Stupid error of the day debugged, after a bit of head scratching…
Three things go into a collection, but only two come out and hit the final log file. I can see them go in, so the comparison logic itself is working just fine…
Just running through the debugger wouldn’t have made me notice. It took figuring out why my Mockito verify set wasn’t satisfied. Aha! Poor choice of map key. Issue resolved. But it still took me 1/2 an hour of poking through. The insertion was happening as part of a Consumer action for an Iterable.forEach, which was a new construct for me. Because it was new, I of course assumed I didn’t “get” how it worked. Nuh-uh – that part worked just fine. Once I actually paid attention to where I was stashing my info, I realized when putting in a second item for key ‘foo’, the first item disappears, if you’re stashing in a Map. Just a ‘doh!’ moment. But certain I wouldn’t have noticed it for quite a while if I hadn’t written out those verify() invocation checks.