### Question:
AMSimulator extends TaskRunner.Task { public AMSimulator() { this.responseQueue = new LinkedBlockingQueue<AllocateResponse>(); } AMSimulator(); void init(int id, int heartbeatInterval, 
      List<ContainerSimulator> containerList, ResourceManager rm, SLSRunner se,
      long traceStartTime, long traceFinishTime, String user, String queue, 
      boolean isTracked, String oldAppId); @Override void firstStep(); @Override void middleStep(); @Override void lastStep(); void untrackApp(); String getQueue(); String getAMType(); long getDuration(); int getNumTasks();  }### Answer:
@Test public void testAMSimulator() throws Exception { MockAMSimulator app = new MockAMSimulator(); List<ContainerSimulator> containers = new ArrayList<ContainerSimulator>(); app.init(1, 1000, containers, rm, null, 0, 1000000l, "user1", "default", false, "app1"); app.firstStep(); Assert.assertEquals(1, rm.getRMContext().getRMApps().size()); Assert.assertNotNull(rm.getRMContext().getRMApps().get(app.appId)); app.lastStep(); }