Source:
<code>public void testSetEncapsulationAction() throws CapabilityException { int actionCount = 0; Response resp = (Response) chassisCapability.sendMessage(ActionConstants.GETCONFIG, null); Assert.assertTrue(resp.getStatus() == Status.OK); Assert.assertTrue(resp.getErrors().size() == 0); actionCount++; resp = (Response) chassisCapability.sendMessage(ActionConstants.SETENCAPSULATION, newParamsInterfaceEthernetPort("fe-0/1/0", 13)); Assert.assertTrue(resp.getStatus() == Status.OK); Assert.assertTrue(resp.getErrors().size() == 0); actionCount++; List<IAction> queue = (List<IAction>) queueCapability.sendMessage(QueueConstants.GETQUEUE, null); Assert.assertTrue(queue.size() == 4); QueueResponse queueResponse = (QueueResponse) queueCapability.sendMessage(QueueConstants.EXECUTE, null); Assert.assertTrue(queueResponse.getResponses().size() == actionCount); for (int i = 0; i < queueResponse.getResponses().size(); i++) { Assert.assertTrue(queueResponse.getResponses().get(i).getStatus() == ActionResponse.STATUS.OK); for (Response response : queueResponse.getResponses().get(i).getResponses()) { Assert.assertTrue(response.getStatus() == Response.Status.OK); } } Assert.assertTrue(queueResponse.getPrepareResponse().getStatus() == ActionResponse.STATUS.OK); Assert.assertTrue(queueResponse.getConfirmResponse().getStatus() == ActionResponse.STATUS.OK); Assert.assertTrue(queueResponse.getRefreshResponse().getStatus() == ActionResponse.STATUS.OK); <START> Assert.assertTrue(queueResponse.getRestoreResponse().getStatus() == ActionResponse.STATUS.PENDING); <END> Assert.assertTrue(queueResponse.isOk()); }</code><technical_language>static import: assertEquals(queueResponse.getPrepareResponse().getStatus(), ActionResponse.STATUS.OK); Is better. Also, if fails, error message tells more</technical_language>

Target:
public void testSetEncapsulationAction() throws CapabilityException { int actionCount = 0; Response resp = (Response) chassisCapability.sendMessage(ActionConstants.GETCONFIG, null); assertEquals(Status.OK, resp.getStatus()); assertTrue("There should be no errors", resp.getErrors().isEmpty()); actionCount++; resp = (Response) chassisCapability.sendMessage(ActionConstants.SETENCAPSULATION, newParamsInterfaceEthernetPort("fe-0/1/0", 13)); assertEquals(Status.OK, resp.getStatus()); assertTrue("There should be no errors", resp.getErrors().isEmpty()); actionCount++; List<IAction> queue = (List<IAction>) queueCapability.sendMessage(QueueConstants.GETQUEUE, null); assertEquals(actionCount, queue.size()); QueueResponse queueResponse = (QueueResponse) queueCapability.sendMessage(QueueConstants.EXECUTE, null); assertEquals(actionCount, queueResponse.getResponses().size()); for (int i = 0; i < queueResponse.getResponses().size(); i++) { assertEquals(ActionResponse.STATUS.OK, queueResponse.getResponses().get(i).getStatus()); for (Response response : queueResponse.getResponses().get(i).getResponses()) { assertEquals(Response.Status.OK, response.getStatus()); } } assertEquals(ActionResponse.STATUS.OK, queueResponse.getPrepareResponse().getStatus()); assertEquals(ActionResponse.STATUS.OK, queueResponse.getConfirmResponse().getStatus()); assertEquals(ActionResponse.STATUS.OK, queueResponse.getRefreshResponse().getStatus()); assertEquals(ActionResponse.STATUS.PENDING, queueResponse.getRestoreResponse().getStatus()); assertTrue("Response should be ok", queueResponse.isOk()); }