@Test public void unknownThreadCountBoth() throws TestSetFailedException { JUnitCoreParameters params = new JUnitCoreParameters( parallel( "both" ) ); assertFalse( params.isParallelSuites() ); assertTrue( params.isParallelClasses() ); assertTrue( params.isParallelMethods() ); exception.expect( TestSetFailedException.class ); resolveConcurrency( params, null ); }
static Concurrency resolveConcurrency( JUnitCoreParameters params, RunnerCounter counts ) throws TestSetFailedException { if ( !params.isParallelismSelected() ) { throw new TestSetFailedException( "Unspecified parameter '" + JUnitCoreParameters.PARALLEL_KEY + "'." ); } if ( !params.isUseUnlimitedThreads() && !hasThreadCount( params ) && !hasThreadCounts( params ) ) { throw new TestSetFailedException( "Unspecified thread-count(s). " + "See the parameters " + JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY + ", " + JUnitCoreParameters.THREADCOUNT_KEY + ", " + JUnitCoreParameters.THREADCOUNTSUITES_KEY + ", " + JUnitCoreParameters.THREADCOUNTCLASSES_KEY + ", " + JUnitCoreParameters.THREADCOUNTMETHODS_KEY + "." ); } if ( params.isUseUnlimitedThreads() ) { return concurrencyForUnlimitedThreads( params ); } else if ( hasThreadCount( params ) ) { if ( hasThreadCounts( params ) ) { return isLeafUnspecified( params ) ? concurrencyFromAllThreadCountsButUnspecifiedLeafCount( params, counts ) : concurrencyFromAllThreadCounts( params ); } else { return estimateConcurrency( params, counts ); } } else { return concurrencyFromThreadCounts( params ); } }
ParallelComputerUtil { static Concurrency resolveConcurrency( JUnitCoreParameters params, RunnerCounter counts ) throws TestSetFailedException { if ( !params.isParallelismSelected() ) { throw new TestSetFailedException( "Unspecified parameter '" + JUnitCoreParameters.PARALLEL_KEY + "'." ); } if ( !params.isUseUnlimitedThreads() && !hasThreadCount( params ) && !hasThreadCounts( params ) ) { throw new TestSetFailedException( "Unspecified thread-count(s). " + "See the parameters " + JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY + ", " + JUnitCoreParameters.THREADCOUNT_KEY + ", " + JUnitCoreParameters.THREADCOUNTSUITES_KEY + ", " + JUnitCoreParameters.THREADCOUNTCLASSES_KEY + ", " + JUnitCoreParameters.THREADCOUNTMETHODS_KEY + "." ); } if ( params.isUseUnlimitedThreads() ) { return concurrencyForUnlimitedThreads( params ); } else if ( hasThreadCount( params ) ) { if ( hasThreadCounts( params ) ) { return isLeafUnspecified( params ) ? concurrencyFromAllThreadCountsButUnspecifiedLeafCount( params, counts ) : concurrencyFromAllThreadCounts( params ); } else { return estimateConcurrency( params, counts ); } } else { return concurrencyFromThreadCounts( params ); } } }
ParallelComputerUtil { static Concurrency resolveConcurrency( JUnitCoreParameters params, RunnerCounter counts ) throws TestSetFailedException { if ( !params.isParallelismSelected() ) { throw new TestSetFailedException( "Unspecified parameter '" + JUnitCoreParameters.PARALLEL_KEY + "'." ); } if ( !params.isUseUnlimitedThreads() && !hasThreadCount( params ) && !hasThreadCounts( params ) ) { throw new TestSetFailedException( "Unspecified thread-count(s). " + "See the parameters " + JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY + ", " + JUnitCoreParameters.THREADCOUNT_KEY + ", " + JUnitCoreParameters.THREADCOUNTSUITES_KEY + ", " + JUnitCoreParameters.THREADCOUNTCLASSES_KEY + ", " + JUnitCoreParameters.THREADCOUNTMETHODS_KEY + "." ); } if ( params.isUseUnlimitedThreads() ) { return concurrencyForUnlimitedThreads( params ); } else if ( hasThreadCount( params ) ) { if ( hasThreadCounts( params ) ) { return isLeafUnspecified( params ) ? concurrencyFromAllThreadCountsButUnspecifiedLeafCount( params, counts ) : concurrencyFromAllThreadCounts( params ); } else { return estimateConcurrency( params, counts ); } } else { return concurrencyFromThreadCounts( params ); } } private  ParallelComputerUtil(); }
ParallelComputerUtil { static Concurrency resolveConcurrency( JUnitCoreParameters params, RunnerCounter counts ) throws TestSetFailedException { if ( !params.isParallelismSelected() ) { throw new TestSetFailedException( "Unspecified parameter '" + JUnitCoreParameters.PARALLEL_KEY + "'." ); } if ( !params.isUseUnlimitedThreads() && !hasThreadCount( params ) && !hasThreadCounts( params ) ) { throw new TestSetFailedException( "Unspecified thread-count(s). " + "See the parameters " + JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY + ", " + JUnitCoreParameters.THREADCOUNT_KEY + ", " + JUnitCoreParameters.THREADCOUNTSUITES_KEY + ", " + JUnitCoreParameters.THREADCOUNTCLASSES_KEY + ", " + JUnitCoreParameters.THREADCOUNTMETHODS_KEY + "." ); } if ( params.isUseUnlimitedThreads() ) { return concurrencyForUnlimitedThreads( params ); } else if ( hasThreadCount( params ) ) { if ( hasThreadCounts( params ) ) { return isLeafUnspecified( params ) ? concurrencyFromAllThreadCountsButUnspecifiedLeafCount( params, counts ) : concurrencyFromAllThreadCounts( params ); } else { return estimateConcurrency( params, counts ); } } else { return concurrencyFromThreadCounts( params ); } } private  ParallelComputerUtil();  }
ParallelComputerUtil { static Concurrency resolveConcurrency( JUnitCoreParameters params, RunnerCounter counts ) throws TestSetFailedException { if ( !params.isParallelismSelected() ) { throw new TestSetFailedException( "Unspecified parameter '" + JUnitCoreParameters.PARALLEL_KEY + "'." ); } if ( !params.isUseUnlimitedThreads() && !hasThreadCount( params ) && !hasThreadCounts( params ) ) { throw new TestSetFailedException( "Unspecified thread-count(s). " + "See the parameters " + JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY + ", " + JUnitCoreParameters.THREADCOUNT_KEY + ", " + JUnitCoreParameters.THREADCOUNTSUITES_KEY + ", " + JUnitCoreParameters.THREADCOUNTCLASSES_KEY + ", " + JUnitCoreParameters.THREADCOUNTMETHODS_KEY + "." ); } if ( params.isUseUnlimitedThreads() ) { return concurrencyForUnlimitedThreads( params ); } else if ( hasThreadCount( params ) ) { if ( hasThreadCounts( params ) ) { return isLeafUnspecified( params ) ? concurrencyFromAllThreadCountsButUnspecifiedLeafCount( params, counts ) : concurrencyFromAllThreadCounts( params ); } else { return estimateConcurrency( params, counts ); } } else { return concurrencyFromThreadCounts( params ); } } private  ParallelComputerUtil();   }