Esp3RdIDBaseResponse extends Esp3ResponsePacket { public DeviceID getBaseID() { return baseID; } Esp3RdIDBaseResponse(byte[] data); DeviceID getBaseID(); static final int ESP3_RESPONSE_RD_IDBASE_ID_INDEX; static final int ESP3_RESPONSE_RD_IDBASE_DATA_LENGTH; }
@Test public void testBasicConstruction() throws Exception { Esp3ResponsePacket.ReturnCode returnCode = Esp3ResponsePacket.ReturnCode.RET_OK; DeviceID deviceID = DeviceID.fromString("0xFF800001"); byte[] dataBytes = createResponseDataBytes(returnCode.getValue(), deviceID); Esp3RdIDBaseResponse response = new Esp3RdIDBaseResponse(dataBytes); Assert.assertEquals(returnCode, response.getReturnCode()); Assert.assertEquals(deviceID, response.getBaseID()); }
@Test public void testBaseID() throws Exception { Esp3ResponsePacket.ReturnCode returnCode = Esp3ResponsePacket.ReturnCode.RET_OK; DeviceID deviceID = DeviceID.fromString("0x12345678"); byte[] dataBytes = createResponseDataBytes(returnCode.getValue(), deviceID); Esp3RdIDBaseResponse response = new Esp3RdIDBaseResponse(dataBytes); Assert.assertEquals(deviceID, response.getBaseID()); deviceID = DeviceID.fromString("0xFFFFFFFF"); dataBytes = createResponseDataBytes(returnCode.getValue(), deviceID); response = new Esp3RdIDBaseResponse(dataBytes); Assert.assertEquals(deviceID, response.getBaseID()); deviceID = DeviceID.fromString("0x00000000"); dataBytes = createResponseDataBytes(returnCode.getValue(), deviceID); response = new Esp3RdIDBaseResponse(dataBytes); Assert.assertEquals(deviceID, response.getBaseID()); }