@Test
public void testAssignWithoutStandby() {

    HashMap<Integer, ClientState<Integer>> states = new HashMap<>();
    for (int i = 0; i < 6; i++) {
        states.put(i, new ClientState<Integer>(1d));
    }
    Set<Integer> tasks;
    Map<Integer, ClientState<Integer>> assignments;
    int numActiveTasks;
    int numAssignedTasks;
    // # of clients and # of tasks are equal.
    tasks = mkSet(0, 1, 2, 3, 4, 5);
    assignments = TaskAssignor.assign(states, tasks, 0);
    numActiveTasks = 0;
    numAssignedTasks = 0;
    for (ClientState<Integer> assignment : assignments.values()) {
        numActiveTasks += assignment.activeTasks.size();
        numAssignedTasks += assignment.assignedTasks.size();
        assertEquals(1, assignment.activeTasks.size());
        assertEquals(1, assignment.assignedTasks.size());
    }
    assertEquals(tasks.size(), numActiveTasks);
    assertEquals(tasks.size(), numAssignedTasks);
    // # of clients < # of tasks
    tasks = mkSet(0, 1, 2, 3, 4, 5, 6, 7);
    assignments = TaskAssignor.assign(states, tasks, 0);
    numActiveTasks = 0;
    numAssignedTasks = 0;
    for (ClientState<Integer> assignment : assignments.values()) {
        numActiveTasks += assignment.activeTasks.size();
        numAssignedTasks += assignment.assignedTasks.size();
        assertTrue(1 <= assignment.activeTasks.size());
        assertTrue(2 >= assignment.activeTasks.size());
        assertTrue(1 <= assignment.assignedTasks.size());
        assertTrue(2 >= assignment.assignedTasks.size());
    }
    assertEquals(tasks.size(), numActiveTasks);
    assertEquals(tasks.size(), numAssignedTasks);
    // # of clients > # of tasks
    tasks = mkSet(0, 1, 2, 3);
    assignments = TaskAssignor.assign(states, tasks, 0);
    numActiveTasks = 0;
    numAssignedTasks = 0;
    for (ClientState<Integer> assignment : assignments.values()) {
        numActiveTasks += assignment.activeTasks.size();
        numAssignedTasks += assignment.assignedTasks.size();
        assertTrue(0 <= assignment.activeTasks.size());
        assertTrue(1 >= assignment.activeTasks.size());
        assertTrue(0 <= assignment.assignedTasks.size());
        assertTrue(1 >= assignment.assignedTasks.size());
    }
    assertEquals(tasks.size(), numActiveTasks);
    assertEquals(tasks.size(), numAssignedTasks);
}