public virtual void TestStatusChange() { //Start the node node.Handle(new RMNodeStartedEvent(null, null, null)); //Add info to the queue first node.SetNextHeartBeat(false); ContainerId completedContainerId1 = BuilderUtils.NewContainerId(BuilderUtils.NewApplicationAttemptId (BuilderUtils.NewApplicationId(0, 0), 0), 0); ContainerId completedContainerId2 = BuilderUtils.NewContainerId(BuilderUtils.NewApplicationAttemptId (BuilderUtils.NewApplicationId(1, 1), 1), 1); RMNodeStatusEvent statusEvent1 = GetMockRMNodeStatusEvent(); RMNodeStatusEvent statusEvent2 = GetMockRMNodeStatusEvent(); ContainerStatus containerStatus1 = Org.Mockito.Mockito.Mock <ContainerStatus>(); ContainerStatus containerStatus2 = Org.Mockito.Mockito.Mock <ContainerStatus>(); Org.Mockito.Mockito.DoReturn(completedContainerId1).When(containerStatus1).GetContainerId (); Org.Mockito.Mockito.DoReturn(Sharpen.Collections.SingletonList(containerStatus1)) .When(statusEvent1).GetContainers(); Org.Mockito.Mockito.DoReturn(completedContainerId2).When(containerStatus2).GetContainerId (); Org.Mockito.Mockito.DoReturn(Sharpen.Collections.SingletonList(containerStatus2)) .When(statusEvent2).GetContainers(); Org.Mockito.Mockito.Verify(scheduler, Org.Mockito.Mockito.Times(1)).Handle(Matchers.Any <NodeUpdateSchedulerEvent>()); node.Handle(statusEvent1); node.Handle(statusEvent2); Org.Mockito.Mockito.Verify(scheduler, Org.Mockito.Mockito.Times(1)).Handle(Matchers.Any <NodeUpdateSchedulerEvent>()); NUnit.Framework.Assert.AreEqual(2, node.GetQueueSize()); node.Handle(new RMNodeEvent(node.GetNodeID(), RMNodeEventType.Expire)); NUnit.Framework.Assert.AreEqual(0, node.GetQueueSize()); }