diff --git a/tests/org/kde/kdeconnect/LanLinkProviderTest.java b/tests/org/kde/kdeconnect/LanLinkProviderTest.java index ce297785..84286c0d 100644 --- a/tests/org/kde/kdeconnect/LanLinkProviderTest.java +++ b/tests/org/kde/kdeconnect/LanLinkProviderTest.java @@ -57,22 +57,14 @@ public class LanLinkProviderTest extends AndroidTestCase { Mockito.when(networkPacket.serialize()).thenReturn(serialized); Socket channel = Mockito.mock(Socket.class); - try { - Method method = LanLinkProvider.class.getDeclaredMethod("identityPacketReceived", NetworkPacket.class, Socket.class, LanLink.ConnectionStarted.class); - method.setAccessible(true); - method.invoke(linkProvider, networkPacket, channel, LanLink.ConnectionStarted.Locally); - } catch (Exception e) { - throw e; - } + Method method = LanLinkProvider.class.getDeclaredMethod("identityPacketReceived", NetworkPacket.class, Socket.class, LanLink.ConnectionStarted.class); + method.setAccessible(true); + method.invoke(linkProvider, networkPacket, channel, LanLink.ConnectionStarted.Locally); HashMap visibleComputers; - try { - Field field = LanLinkProvider.class.getDeclaredField("visibleComputers"); - field.setAccessible(true); - visibleComputers = (HashMap) field.get(linkProvider); - } catch (Exception e) { - throw e; - } + Field field = LanLinkProvider.class.getDeclaredField("visibleComputers"); + field.setAccessible(true); + visibleComputers = (HashMap) field.get(linkProvider); assertNotNull(visibleComputers.get("testDevice")); } diff --git a/tests/org/kde/kdeconnect/LanLinkTest.java b/tests/org/kde/kdeconnect/LanLinkTest.java index c2758aaf..cda2da58 100644 --- a/tests/org/kde/kdeconnect/LanLinkTest.java +++ b/tests/org/kde/kdeconnect/LanLinkTest.java @@ -130,11 +130,7 @@ public class LanLinkTest extends AndroidTestCase { socket.connect(new InetSocketAddress(address.getAddress(), tcpPort)); np.setPayload(socket.getInputStream(), np.getPayloadSize()); } catch (Exception e) { - try { - socket.close(); - } catch (Exception ignored) { - throw ignored; - } + socket.close(); e.printStackTrace(); Log.e("KDE/LanLinkTest", "Exception connecting to remote socket"); throw e;