Skip to content

Commit

Permalink
Create and use mock scan result class
Browse files Browse the repository at this point in the history
  • Loading branch information
nrbrook committed Jul 27, 2020
1 parent a5b547b commit eb7d009
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,13 @@ public boolean test(ScanResult scanResult) {
}

@NonNull
private ScanResult createScanResult(RxBleDeviceMock rxBleDeviceMock) {
private RxBleScanResultMock createScanResult(RxBleDeviceMock rxBleDeviceMock) {
return convertToPublicScanResult(rxBleDeviceMock, rxBleDeviceMock.getRssi(), rxBleDeviceMock.getScanRecord());
}

@NonNull
private static ScanResult convertToPublicScanResult(RxBleDevice bleDevice, Integer rssi, ScanRecord scanRecord) {
return new ScanResult(
private static RxBleScanResultMock convertToPublicScanResult(RxBleDevice bleDevice, Integer rssi, ScanRecord scanRecord) {
return new RxBleScanResultMock (
bleDevice,
rssi,
System.currentTimeMillis() * 1000000,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.polidea.rxandroidble2.mockrxandroidble;

import com.polidea.rxandroidble2.RxBleDevice;
import com.polidea.rxandroidble2.scan.ScanCallbackType;
import com.polidea.rxandroidble2.scan.ScanRecord;
import com.polidea.rxandroidble2.scan.ScanResult;

public class RxBleScanResultMock extends ScanResult {
public RxBleScanResultMock(RxBleDevice bleDevice, int rssi, long timestampNanos, ScanCallbackType callbackType, ScanRecord scanRecord) {
super(bleDevice, rssi, timestampNanos, callbackType, scanRecord);
}
}

0 comments on commit eb7d009

Please sign in to comment.