### Question:
DataStatistics implements Iterable<DataStatistics.RelationshipTypeCount> { public synchronized Client newClient() { Client client = new Client(); clients.add( client ); opened++; return client; } DataStatistics( long nodeCount, long propertyCount, RelationshipTypeCount[] sortedTypes );  DataStatistics( DataImporter.Monitor entityCounts, RelationshipTypeCount[] sortedTypes ); @Override Iterator<RelationshipTypeCount> iterator(); int getNumberOfRelationshipTypes(); synchronized Client newClient(); RelationshipTypeCount get( int index ); IntSet types( int startingFromType, int upToType ); long getNodeCount(); long getPropertyCount(); long getRelationshipCount(); @Override String toString();  }### Answer:
@Test public void shouldSumCounts() throws Throwable { DataStatistics stats = new DataStatistics( 1, 2, new RelationshipTypeCount[0] ); Race race = new Race(); int types = 10; long[] expected = new long[types]; int threads = Runtime.getRuntime().availableProcessors(); for ( int i = 0; i < threads; i++ ) { long[] local = new long[types]; for ( int j = 0; j < types; j++ ) { local[j] = random.nextInt( 1_000, 2_000 ); expected[j] += local[j]; } race.addContestant( () -> { try ( DataStatistics.Client client = stats.newClient() ) { for ( int typeId = 0; typeId < types; typeId++ ) { while ( local[typeId]-- > 0 ) { client.increment( typeId ); } } } } ); } race.go(); stats.forEach( count -> assertEquals( expected[count.getTypeId()], count.getCount() ) ); }