On Jul 30, 2013, at 4:57 PM, Chris Hegarty <chris.hega...@oracle.com> wrote: > Paul, > > This looks like a nice cleanup, as well as fixing the timeout issue. > > I just don't get the change in failure criteria. The old test used to verify > that the arrays of random numbers of all generating threads were not equal, > but now your checking the number of tasks? >
Previously the first result was checked if it was distinct. Now it checks all results are unique: add results to a set, if results are distinct the size should be the same as the # tasks producing the results. Note i was carefully to replace arrays with lists to ensure equals by content not reference. In fact it would be clearer to do: int rc = cfs.stream().map(CompletableFuture::join).distinct().count(); assertEquals(rc, tasks); Paul.