mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-30 05:37:43 +00:00
Also verify that Device.PairingCallback.pairingSuccessful() is called
This commit is contained in:
parent
9d5a6fa0fd
commit
b135ffa92a
@ -152,6 +152,9 @@ public class DeviceTest {
|
|||||||
Mockito.when(link.getPairingHandler(any(Device.class), any(BasePairingHandler.PairingHandlerCallback.class))).thenReturn(Mockito.mock(LanPairingHandler.class));
|
Mockito.when(link.getPairingHandler(any(Device.class), any(BasePairingHandler.PairingHandlerCallback.class))).thenReturn(Mockito.mock(LanPairingHandler.class));
|
||||||
Device device = new Device(context, fakeNetworkPacket, link);
|
Device device = new Device(context, fakeNetworkPacket, link);
|
||||||
|
|
||||||
|
Device.PairingCallback pairingCallback = Mockito.mock(Device.PairingCallback.class);
|
||||||
|
device.addPairingCallback(pairingCallback);
|
||||||
|
|
||||||
KeyPair keyPair;
|
KeyPair keyPair;
|
||||||
try {
|
try {
|
||||||
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
|
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
|
||||||
@ -181,6 +184,7 @@ public class DeviceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assertTrue(device.isPaired());
|
assertTrue(device.isPaired());
|
||||||
|
Mockito.verify(pairingCallback, Mockito.times(1)).pairingSuccessful();
|
||||||
|
|
||||||
SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE);
|
SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE);
|
||||||
assertTrue(preferences.getBoolean(device.getDeviceId(), false));
|
assertTrue(preferences.getBoolean(device.getDeviceId(), false));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user