From b135ffa92a6657f305b45fc601a46a17a615c042 Mon Sep 17 00:00:00 2001 From: Erik Duisters Date: Sun, 3 Mar 2019 16:44:20 +0100 Subject: [PATCH] Also verify that Device.PairingCallback.pairingSuccessful() is called --- tests/org/kde/kdeconnect/DeviceTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/org/kde/kdeconnect/DeviceTest.java b/tests/org/kde/kdeconnect/DeviceTest.java index c69d114f..41ab8247 100644 --- a/tests/org/kde/kdeconnect/DeviceTest.java +++ b/tests/org/kde/kdeconnect/DeviceTest.java @@ -152,6 +152,9 @@ public class DeviceTest { Mockito.when(link.getPairingHandler(any(Device.class), any(BasePairingHandler.PairingHandlerCallback.class))).thenReturn(Mockito.mock(LanPairingHandler.class)); Device device = new Device(context, fakeNetworkPacket, link); + Device.PairingCallback pairingCallback = Mockito.mock(Device.PairingCallback.class); + device.addPairingCallback(pairingCallback); + KeyPair keyPair; try { KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); @@ -181,6 +184,7 @@ public class DeviceTest { } assertTrue(device.isPaired()); + Mockito.verify(pairingCallback, Mockito.times(1)).pairingSuccessful(); SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE); assertTrue(preferences.getBoolean(device.getDeviceId(), false));