Mockito.doAnswer(new Answer() {
public Object answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
ContainerId cId = (ContainerId) args[0];
scheduler.deallocateContainer(cId);
return null;
}})
.when(mockApp).preemptContainer((ContainerId)any());
scheduler.onContainersAllocated(containers);