### Question:
SpeedAndCadenceControlPointDataCallback extends ProfileReadResponse implements SpeedAndCadenceControlPointCallback { @Override public void onDataReceived(@NonNull final BluetoothDevice device, @NonNull final Data data) { super.onDataReceived(device, data); if (data.size() < 3) { onInvalidDataReceived(device, data); return; } final int responseCode = data.getIntValue(Data.FORMAT_UINT8, 0); final int requestCode = data.getIntValue(Data.FORMAT_UINT8, 1); final int status = data.getIntValue(Data.FORMAT_UINT8, 2); if (responseCode != SC_OP_CODE_RESPONSE_CODE) { onInvalidDataReceived(device, data); return; } if (status != SC_RESPONSE_SUCCESS) { onSCOperationError(device, requestCode, status); return; } switch (requestCode) { case SC_OP_CODE_REQUEST_SUPPORTED_SENSOR_LOCATIONS: { final int size = data.size() - 3; final int[] locations = new int[size]; for (int i = 0; i < size; ++i) { locations[i] = data.getIntValue(Data.FORMAT_UINT8, 3 + i); } onSupportedSensorLocationsReceived(device, locations); break; } default: { onSCOperationCompleted(device, requestCode); break; } } } SpeedAndCadenceControlPointDataCallback(); protected  SpeedAndCadenceControlPointDataCallback(final Parcel in); @Override void onDataReceived(@NonNull final BluetoothDevice device, @NonNull final Data data);  }### Answer:
@Test public void onSCOperationCompleted() { final MutableData data = new MutableData(new byte[] { 0x10, 0x01, 0x01}); response.onDataReceived(null, data); assertTrue(success); assertEquals(0, errorCode); assertEquals(1, requestCode); assertNull(locations); }
@Test public void onSCOperationError() { final MutableData data = new MutableData(new byte[] { 0x10, 0x02, 0x02}); response.onDataReceived(null, data); assertFalse(success); assertEquals(2, errorCode); assertEquals(2, requestCode); assertNull(locations); }
@Test public void onSupportedSensorLocationsReceived() { final MutableData data = new MutableData(new byte[] { 0x10, 0x04, 0x01, 1, 2, 3}); response.onDataReceived(null, data); assertTrue(success); assertEquals(0, errorCode); assertEquals(4, requestCode); assertNotNull(locations); assertEquals(3, locations.length); assertEquals(2, locations[1]); }
@Test public void onInvalidDataReceived() { final MutableData data = new MutableData(new byte[] { 0x01, 0x01, 0x00, 0x00, 0x00}); response.onDataReceived(null, data); assertFalse(success); assertEquals(0, errorCode); assertFalse(response.isValid()); assertEquals(0, requestCode); assertNull(locations); }