Esp2RdIDBaseCommand extends AbstractEsp2Command { public DeviceID getBaseID() { if(response == null) { return null; } return ((Esp2RdIDBaseResponse)response).getBaseID(); } Esp2RdIDBaseCommand(); @Override Esp2RdIDBaseResponse createResponseFromPacket(Esp2Packet response); @Override Esp2RdIDBaseResponse getResponse(); DeviceID getBaseID();  }
@Test public void testSend() throws Exception { TestProcessor processor = new TestProcessor(response); Esp2RdIDBaseCommand command = new Esp2RdIDBaseCommand(); command.send(processor); Assert.assertEquals(returnCode, command.getReturnCode()); Assert.assertEquals(baseID, command.getBaseID()); }
@Test public void testRepeatedSend() throws Exception { TestProcessor processor = new TestProcessor(response); Esp2RdIDBaseCommand command = new Esp2RdIDBaseCommand(); command.send(processor); processor = new TestProcessor(null); command.send(processor); Assert.assertEquals(Esp2ResponsePacket.ReturnCode.RET_CODE_NOT_SET, command.getReturnCode()); Assert.assertNull(command.getBaseID()); processor = new TestProcessor(response); command.send(processor); Assert.assertEquals(returnCode, command.getReturnCode()); Assert.assertEquals(baseID, command.getBaseID()); }