### Question:
CyclingSpeedAndCadenceFeatureDataCallback extends ProfileReadResponse implements CyclingSpeedAndCadenceFeatureCallback { @Override public void onDataReceived(@NonNull final BluetoothDevice device, @NonNull final Data data) { super.onDataReceived(device, data); if (data.size() != 2) { onInvalidDataReceived(device, data); return; } final int value = data.getIntValue(Data.FORMAT_UINT16, 0); final CSCFeatures features = new CSCFeatures(value); onCyclingSpeedAndCadenceFeaturesReceived(device, features); } CyclingSpeedAndCadenceFeatureDataCallback(); protected  CyclingSpeedAndCadenceFeatureDataCallback(final Parcel in); @Override void onDataReceived(@NonNull final BluetoothDevice device, @NonNull final Data data);  }### Answer:
@Test public void onCyclingSpeedAndCadenceFeaturesReceived() { final ProfileReadResponse callback = new CyclingSpeedAndCadenceFeatureDataCallback() { @Override public void onCyclingSpeedAndCadenceFeaturesReceived(@NonNull final BluetoothDevice device, @NonNull final CSCFeatures features) { called = true; assertNotNull(features); assertTrue("Wheel revolutions supported", features.wheelRevolutionDataSupported); assertTrue("Crank revolutions supported", features.crankRevolutionDataSupported); assertFalse("Multiple sensors not supported", features.multipleSensorDataSupported); assertEquals("Feature value", 0x03, features.value); } }; called = false; final Data data = new Data(new byte[] { 0x03, 0x00 }); callback.onDataReceived(null, data); assertTrue(called); assertTrue(callback.isValid()); }
@Test public void onInvalidDataReceived() { final ProfileReadResponse callback = new CyclingSpeedAndCadenceFeatureDataCallback() { @Override public void onCyclingSpeedAndCadenceFeaturesReceived(@NonNull final BluetoothDevice device, @NonNull final CSCFeatures features) { called = true; } }; called = false; final Data data = new Data(new byte[] { 0x03 }); callback.onDataReceived(null, data); assertFalse(called); assertFalse(callback.isValid()); }