From 7e935a495ebfe5cbc68a0f0b3d2c8e647f18f673 Mon Sep 17 00:00:00 2001 From: Philip Cohn-Cort Date: Wed, 11 Mar 2020 01:01:46 -0400 Subject: [PATCH] Remove old protocol v6 code from DeviceTest.java --- tests/org/kde/kdeconnect/DeviceTest.java | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/tests/org/kde/kdeconnect/DeviceTest.java b/tests/org/kde/kdeconnect/DeviceTest.java index b0e8ef0f..9ace96e0 100644 --- a/tests/org/kde/kdeconnect/DeviceTest.java +++ b/tests/org/kde/kdeconnect/DeviceTest.java @@ -155,17 +155,6 @@ public class DeviceTest { Device.PairingCallback pairingCallback = Mockito.mock(Device.PairingCallback.class); device.addPairingCallback(pairingCallback); - KeyPair keyPair; - try { - KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); - keyGen.initialize(2048); - keyPair = keyGen.genKeyPair(); - } catch (Exception e) { - Log.e("KDE/initializeRsaKeys", "Exception", e); - Log.e("KDE/initializeRsaKeys", "Exception", e); - return; - } - device.publicKey = keyPair.getPublic(); ArgumentCaptor pairingHandlerCallback = ArgumentCaptor.forClass(BasePairingHandler.PairingHandlerCallback.class); Mockito.verify(link, Mockito.times(1)).getPairingHandler(eq(device), pairingHandlerCallback.capture()); @@ -174,7 +163,6 @@ public class DeviceTest { assertEquals(device.getDeviceId(), "unpairedTestDevice"); assertEquals(device.getName(), "Unpaired Test Device"); assertEquals(device.getDeviceType(), Device.DeviceType.Phone); - assertNotNull(device.publicKey); assertNull(device.certificate); pairingHandlerCallback.getValue().pairingDone(); @@ -196,14 +184,6 @@ public class DeviceTest { @Test public void testPairingDoneWithCertificate() { - KeyPair keyPair = null; - try { - KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); - keyGen.initialize(2048); - keyPair = keyGen.genKeyPair(); - } catch (Exception e) { - Log.e("KDE/initializeRsaKeys", "Exception", e); - } NetworkPacket fakeNetworkPacket = new NetworkPacket(NetworkPacket.PACKET_TYPE_IDENTITY); fakeNetworkPacket.set("deviceId", "unpairedTestDevice"); @@ -234,13 +214,11 @@ public class DeviceTest { Mockito.when(link.getPairingHandler(any(Device.class), any(BasePairingHandler.PairingHandlerCallback.class))).thenReturn(Mockito.mock(LanPairingHandler.class)); Mockito.when(link.getLinkProvider()).thenReturn(linkProvider); Device device = new Device(context, fakeNetworkPacket, link); - device.publicKey = keyPair.getPublic(); assertNotNull(device); assertEquals(device.getDeviceId(), "unpairedTestDevice"); assertEquals(device.getName(), "Unpaired Test Device"); assertEquals(device.getDeviceType(), Device.DeviceType.Phone); - assertNotNull(device.publicKey); assertNotNull(device.certificate); Method method;