### Question:
TemperatureTypeDataCallback extends ProfileReadResponse implements TemperatureTypeCallback { @Override public void onDataReceived(@NonNull final BluetoothDevice device, @NonNull final Data data) { super.onDataReceived(device, data); if (data.size() != 1) { onInvalidDataReceived(device, data); return; } final int type = data.getIntValue(Data.FORMAT_UINT8, 0); onTemperatureTypeReceived(device, type); } TemperatureTypeDataCallback(); protected  TemperatureTypeDataCallback(final Parcel in); @Override void onDataReceived(@NonNull final BluetoothDevice device, @NonNull final Data data);  }### Answer:
@Test public void onMeasurementIntervalReceived() { final ProfileReadResponse response = new TemperatureTypeDataCallback() { @Override public void onTemperatureTypeReceived(@NonNull final BluetoothDevice device, final int type) { called = true; assertEquals("Temperature Type", HealthThermometerTypes.TYPE_EAR, type); } }; called = false; final Data data = new Data(new byte[] { 3 }); response.onDataReceived(null, data); assertTrue(response.isValid()); assertTrue(called); }
@Test public void onInvalidDataReceived() { final ProfileReadResponse response = new TemperatureTypeDataCallback() { @Override public void onTemperatureTypeReceived(@NonNull final BluetoothDevice device, final int type) { called = true; } }; called = false; final Data data = new Data(new byte[] { 3, 0 }); response.onDataReceived(null, data); assertFalse(called); assertFalse(response.isValid()); }