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