    @Test
    public void testCheckoutProjectMultiple()
        throws Exception
    {

        setupMockOverallBuildQueues();

        BuildDefinition buildDef = new BuildDefinition();
        buildDef.setId( 1 );
        buildDef.setSchedule( getSchedule( 1, 1, 2 ) );

        setupCheckoutProjectBuildQueuesAreEmpty();

        buildsManager.checkoutProject( 1, "continuum-project-test-1",
                                       new File( getBasedir(), "/target/test-working-dir/1" ), null,
                                       "dummy", "dummypass", buildDef, null );

        verify( overallBuildQueue ).addToCheckoutQueue( any( CheckOutTask.class ) );

        // queue second project - 1st queue has 1 task while 2nd queue is empty; project should be queued in 2nd queue
        reset( overallBuildQueue );
        recordStartOfCheckoutProjectSequence();

        List<Task> tasks = new ArrayList<Task>();
        List<Task> tasksInFirstCheckoutQueue = new ArrayList<Task>();
        tasksInFirstCheckoutQueue.add( new CheckOutTask( 1,
                                                         new File( getBasedir(), "/target/test-working-dir/1" ),
                                                         "continuum-project-test-1", "dummy", "dummypass", null,
                                                         null ) );

        when( checkoutQueue.getQueueSnapshot() ).thenReturn( tasksInFirstCheckoutQueue, tasks );
        when( checkoutTaskQueueExecutor.getCurrentTask() ).thenReturn( null );
        when( overallBuildQueue.getName() ).thenReturn( "BUILD_QUEUE_3" );

        buildsManager.checkoutProject( 2, "continuum-project-test-2", new File( getBasedir(),
                                                                                "/target/test-working-dir/1" ), null,
                                       "dummy", "dummypass", buildDef, null );

        verify( overallBuildQueue ).addToCheckoutQueue( any( CheckOutTask.class ) );

        reset( overallBuildQueue );
        recordStartOfCheckoutProjectSequence();

        // queue third project - both queues have 1 task queued each; third project should be queued in 1st queue
        when( checkoutQueue.getQueueSnapshot() ).thenReturn( tasksInFirstCheckoutQueue );
        when( checkoutTaskQueueExecutor.getCurrentTask() ).thenReturn( null );
        when( overallBuildQueue.getName() ).thenReturn( "BUILD_QUEUE_2" );

        buildsManager.checkoutProject( 3, "continuum-project-test-3",
                                       new File( getBasedir(), "/target/test-working-dir/1" ), null,
                                       "dummy", "dummypass", buildDef, null );

        verify( overallBuildQueue ).addToCheckoutQueue( any( CheckOutTask.class ) );
    }