Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ad051ed authored by Antony Sargent's avatar Antony Sargent
Browse files

Add a convenience method to facilitate tests

In app tests (as opposed to RoboTests), we don't have a shadow
BluetoothSettings class and can't mock it because it's final, but we
need a way to mock out the address of a CachedBluetoothDevice. So this
adds a convenience method on CachedBluetoothDevice that can be mocked.

Bug: 62447414
Test: (should be covered by other tests)
Change-Id: If818d3dcc783b4aa03f7c6d7c441ba44ea980ab7
parent 392ac74f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -368,6 +368,15 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
        return mDevice;
    }

    /**
     * Convenience method that can be mocked - it lets tests avoid having to call getDevice() which
     * causes problems in tests since BluetoothDevice is final and cannot be mocked.
     * @return the address of this device
     */
    public String getAddress() {
        return mDevice.getAddress();
    }

    public String getName() {
        return mName;
    }