### Question:
DefaultOverallBuildQueue implements OverallBuildQueue { public boolean isInBuildQueue( int projectId ) throws TaskQueueException { return isInBuildQueue( projectId, -1 ); }  int getId(); void setId( int id ); String getName(); void setName( String name ); void addToCheckoutQueue( CheckOutTask checkoutTask ); void addToCheckoutQueue( List<CheckOutTask> checkoutTasks ); List<CheckOutTask> getProjectsInCheckoutQueue(); boolean isInCheckoutQueue( int projectId ); boolean removeProjectFromCheckoutQueue( int projectId ); boolean removeProjectsFromCheckoutQueue( int[] projectsId ); void removeTasksFromCheckoutQueueWithHashCodes( int[] hashCodes ); void addToBuildQueue( BuildProjectTask buildTask ); void addToBuildQueue( List<BuildProjectTask> buildTasks ); List<BuildProjectTask> getProjectsInBuildQueue(); boolean isInBuildQueue( int projectId ); boolean isInBuildQueue( int projectId, int buildDefinitionId ); void cancelBuildTask( int projectId ); void cancelCheckoutTask( int projectId ); boolean cancelCurrentBuild(); boolean cancelCurrentCheckout(); boolean removeProjectFromBuildQueue( int projectId, int buildDefinitionId, BuildTrigger buildTrigger,
                                                String projectName, int projectGroupId ); boolean removeProjectsFromBuildQueue( int[] projectIds ); boolean removeProjectFromBuildQueue( int projectId ); void removeProjectsFromBuildQueueWithHashCodes( int[] hashCodes ); void addToPrepareBuildQueue( PrepareBuildProjectsTask prepareBuildTask ); void addToPrepareBuildQueue( List<PrepareBuildProjectsTask> prepareBuildTasks ); List<PrepareBuildProjectsTask> getProjectsInPrepareBuildQueue(); boolean isInPrepareBuildQueue( int projectId ); boolean isInPrepareBuildQueue( int projectGroupId, int scmRootId ); boolean isInPrepareBuildQueue( int projectGroupId, String scmRootAddress ); void cancelPrepareBuildTask( int projectGroupId, int scmRootId ); void cancelPrepareBuildTask( int projectId ); boolean cancelCurrentPrepareBuild(); boolean removeProjectFromPrepareBuildQueue( int projectGroupId, int scmRootId ); boolean removeProjectFromPrepareBuildQueue( int projectGroupId, String scmRootAddress ); void removeProjectsFromPrepareBuildQueueWithHashCodes( int[] hashCodes ); TaskQueue getCheckoutQueue(); TaskQueue getBuildQueue(); TaskQueue getPrepareBuildQueue(); TaskQueueExecutor getBuildTaskQueueExecutor(); TaskQueueExecutor getCheckoutTaskQueueExecutor(); TaskQueueExecutor getPrepareBuildTaskQueueExecutor(); void setBuildDefinitionDao( BuildDefinitionDao buildDefinitionDao ); void setBuildTaskQueueExecutor( TaskQueueExecutor buildTaskQueueExecutor ); void setCheckoutTaskQueueExecutor( TaskQueueExecutor checkoutTaskQueueExecutor ); void setPrepareBuildTaskQueueExecutor( TaskQueueExecutor prepareBuildTaskQueueExecutor );  }### Answer:
@Test public void testIsInBuildQueue() throws Exception { TaskQueue buildQueue = mock( TaskQueue.class, "build-queue" ); List<Task> tasks = new ArrayList<Task>(); tasks.add( new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2", "BUILD_DEF", null, 2 ) ); when( buildTaskQueueExecutor.getQueue() ).thenReturn( buildQueue ); when( buildQueue.getQueueSnapshot() ).thenReturn( tasks ); assertTrue( overallQueue.isInBuildQueue( 2 ) ); }