private void performLimitTest( int limit, int tasks, int values ) { Filter filter = new Limit( limit ); int count = 0; for( int i = 0; i < tasks; i++ ) { FlowProcess process = new TestFlowProcess( tasks, i ); filter.prepare( process, operationCall ); operationCall.setArguments( getEntry( new Tuple( 1 ) ) ); for( int j = 0; j < values; j++ ) { if( !filter.isRemove( process, operationCall ) ) count++; } } String message = String.format( "limit:%d tasks:%d values:%d", limit, tasks, values ); assertEquals( message, Math.min( limit, values * tasks ), count ); } }