Я просто не понимаю, почему мой метод-заглушка scanBleDevices () внутри функции scan () не возвращает возвращаемый объект.
BluetoothAdapter:
fun scan(scanTimeoutMillis: Long): Flowable<Packet> = bluetoothClient
.scanBleDevices(ScanSettings.Builder()
.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build())....
Test:
val spyBleAdapter = Mockito.spy(viewModel.scanBluetoothFlowabler.bluetoothAdapter)
viewModel.scanBluetoothFlowabler.bluetoothAdapter = spyBleAdapter
val spyBleClient = Mockito.spy(spyBleAdapter.bluetoothClient)
spyBleAdapter.bluetoothClient = spyBleClient
whenever(spyBleClient.scanBleDevices(fakeScanSettings))
.thenReturn(Observable.just(mockScanResult))
// here it returns mockScanResult
val scanBleDevices = spyBleClient.scanBleDevices(fakeScanSettings)
// scanBleDevices() inside scan() is not stubbed so i got not implemented exception
val scan = spyBleAdapter.scan(ArgumentMatchers.anyLong())
Что я делаю не так?