mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-01 06:35:09 +00:00
Clean up formatting
This commit is contained in:
@@ -63,7 +63,6 @@ public class DeviceTest {
|
|||||||
// Creating a paired device before each test case
|
// Creating a paired device before each test case
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
|
||||||
// Save new test device in settings
|
// Save new test device in settings
|
||||||
|
|
||||||
String deviceId = "testDevice";
|
String deviceId = "testDevice";
|
||||||
@@ -113,26 +112,23 @@ public class DeviceTest {
|
|||||||
RsaHelper.initialiseRsaKeys(context);
|
RsaHelper.initialiseRsaKeys(context);
|
||||||
|
|
||||||
Mockito.when(context.getSystemService(eq(Context.NOTIFICATION_SERVICE))).thenReturn(Mockito.mock(NotificationManager.class));
|
Mockito.when(context.getSystemService(eq(Context.NOTIFICATION_SERVICE))).thenReturn(Mockito.mock(NotificationManager.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basic paired device testing
|
// Basic paired device testing
|
||||||
@Test
|
@Test
|
||||||
public void testDevice() {
|
public void testDevice() {
|
||||||
|
|
||||||
Device device = new Device(context, "testDevice");
|
Device device = new Device(context, "testDevice");
|
||||||
|
|
||||||
assertEquals(device.getDeviceId(), "testDevice");
|
assertEquals(device.getDeviceId(), "testDevice");
|
||||||
assertEquals(device.getDeviceType(), Device.DeviceType.Phone);
|
assertEquals(device.getDeviceType(), Device.DeviceType.Phone);
|
||||||
assertEquals(device.getName(), "Test Device");
|
assertEquals(device.getName(), "Test Device");
|
||||||
assertTrue(device.isPaired());
|
assertTrue(device.isPaired());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Testing pairing done using reflection since it is private
|
// Testing pairing done using reflection since it is private
|
||||||
// Created an unpaired device inside this test
|
// Created an unpaired device inside this test
|
||||||
@Test
|
@Test
|
||||||
public void testPairingDone() {
|
public void testPairingDone() {
|
||||||
|
|
||||||
NetworkPacket fakeNetworkPacket = new NetworkPacket(NetworkPacket.PACKET_TYPE_IDENTITY);
|
NetworkPacket fakeNetworkPacket = new NetworkPacket(NetworkPacket.PACKET_TYPE_IDENTITY);
|
||||||
fakeNetworkPacket.set("deviceId", "unpairedTestDevice");
|
fakeNetworkPacket.set("deviceId", "unpairedTestDevice");
|
||||||
fakeNetworkPacket.set("deviceName", "Unpaired Test Device");
|
fakeNetworkPacket.set("deviceName", "Unpaired Test Device");
|
||||||
@@ -186,7 +182,6 @@ public class DeviceTest {
|
|||||||
// Cleanup for unpaired test device
|
// Cleanup for unpaired test device
|
||||||
preferences.edit().remove(device.getDeviceId()).apply();
|
preferences.edit().remove(device.getDeviceId()).apply();
|
||||||
settings.edit().clear().apply();
|
settings.edit().clear().apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -264,7 +259,6 @@ public class DeviceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnpair() {
|
public void testUnpair() {
|
||||||
|
|
||||||
Device device = new Device(context, "testDevice");
|
Device device = new Device(context, "testDevice");
|
||||||
|
|
||||||
device.unpair();
|
device.unpair();
|
||||||
@@ -273,8 +267,5 @@ public class DeviceTest {
|
|||||||
|
|
||||||
SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE);
|
SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE);
|
||||||
assertFalse(preferences.getBoolean(device.getDeviceId(), false));
|
assertFalse(preferences.getBoolean(device.getDeviceId(), false));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user