private Map < String , Integer > runSampling ( final ProctorContext proctorContext , final Set < String > targetTestNames , final TestType testType , final int determinationsToRun ) { final Set < String > targetTestGroups = getTargetTestGroups ( targetTestNames ) ; final Map < String , Integer > testGroupToOccurrences = Maps . newTreeMap ( ) ; for ( final String testGroup : targetTestGroups ) { testGroupToOccurrences . put ( testGroup , 0 ) ; } for ( int i = 0 ; i < determinationsToRun ; ++ i ) { final Identifiers identifiers = TestType . RANDOM . equals ( testType ) ? new Identifiers ( Collections . < TestType , String > emptyMap ( ) , /* randomEnabled */ true ) : Identifiers . of ( testType , Long . toString ( random . nextLong ( ) ) ) ; final AbstractGroups groups = supplier . getRandomGroups ( proctorContext , identifiers ) ; for ( final Entry < String , TestBucket > e : groups . getProctorResult ( ) . getBuckets ( ) . entrySet ( ) ) { final String testName = e . getKey ( ) ; if ( targetTestNames . contains ( testName ) ) { final int group = e . getValue ( ) . getValue ( ) ; final String testGroup = testName + group ; testGroupToOccurrences . put ( testGroup , testGroupToOccurrences . get ( testGroup ) + 1 ) ; } } } return testGroupToOccurrences ; }
test how many times the group was present in the list of groups .