@Test public void collectCharWithTarget() { CharHashBag target = new CharHashBag(); CharHashBag result = this.newBag().collectChar((CharFunction<String>) string -> string.charAt(0), target); Assert.assertSame("Target sent as parameter not returned", target, result); Assert.assertEquals(this.numKeys(), result.sizeDistinct()); for (int i = 1; i <= this.numKeys(); i++) { Assert.assertEquals(i, result.occurrencesOf((char) ((int) '0' + i))); } }