when(mockManagedVertex.getTotalTasks()).thenReturn(managedTasks.size());
when(mockManagedVertex.getTasks()).thenReturn(managedTasks);
final HashSet<TezTaskID> scheduledTasks = new HashSet<TezTaskID>();
doAnswer(new Answer() {
public Object answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
scheduledTasks.clear();
scheduledTasks.addAll((Collection<TezTaskID>)args[0]);
return null;
}}).when(mockManagedVertex).scheduleTasks(anyCollection());
final Map<Vertex, EdgeManager> newEdgeManagers = new HashMap<Vertex, EdgeManager>();
doAnswer(new Answer() {
public Object answer(InvocationOnMock invocation) {
managedTasks.remove(mockTaskId3);
managedTasks.remove(mockTaskId4);
newEdgeManagers.clear();
newEdgeManagers.putAll((Map<Vertex, EdgeManager>)invocation.getArguments()[1]);