### Question:
ResourceManager { public boolean canSchedule(SchedulerGroupAccountant accountant) { return accountant.totalReservedThreads() < getTableThreadsHardLimit(); } ResourceManager(PinotConfiguration config); void stop(); final int getNumQueryRunnerThreads(); final int getNumQueryWorkerThreads(); final ListeningExecutorService getQueryRunners(); @VisibleForTesting final ExecutorService getQueryWorkers(); abstract QueryExecutorService getExecutorService(ServerQueryRequest query,
      SchedulerGroupAccountant accountant); abstract int getTableThreadsHardLimit(); abstract int getTableThreadsSoftLimit(); boolean canSchedule(SchedulerGroupAccountant accountant); static final String QUERY_RUNNER_CONFIG_KEY; static final String QUERY_WORKER_CONFIG_KEY; static final int DEFAULT_QUERY_RUNNER_THREADS; static final int DEFAULT_QUERY_WORKER_THREADS; }### Answer:
@Test public void testCanSchedule() throws Exception { ResourceManager rm = getResourceManager(2, 5, 1, 3); SchedulerGroupAccountant accountant = mock(SchedulerGroupAccountant.class); when(accountant.totalReservedThreads()).thenReturn(3); assertFalse(rm.canSchedule(accountant)); when(accountant.totalReservedThreads()).thenReturn(2); assertTrue(rm.canSchedule(accountant)); }