Esp3RdIDBaseCommand extends AbstractEsp3Command { public DeviceID getBaseID() { if(response == null) { return null; } return ((Esp3RdIDBaseResponse)response).getBaseID(); } Esp3RdIDBaseCommand(); @Override Esp3RdIDBaseResponse createResponseFromPacket(Esp3Packet response); @Override Esp3RdIDBaseResponse getResponse(); DeviceID getBaseID();  }
@Test public void testSend() throws Exception { TestProcessor processor = new TestProcessor(response); Esp3RdIDBaseCommand command = new Esp3RdIDBaseCommand(); command.send(processor); Assert.assertEquals(returnCode, command.getReturnCode()); Assert.assertEquals(baseID, command.getBaseID()); }
@Test public void testRepeatedSend() throws Exception { TestProcessor processor = new TestProcessor(response); Esp3RdIDBaseCommand command = new Esp3RdIDBaseCommand(); command.send(processor); processor = new TestProcessor(null); command.send(processor); Assert.assertEquals(Esp3ResponsePacket.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()); }