1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-20 12:00:51 +02:00

Fix tests

This commit is contained in:
José Rebelo 2023-10-04 21:58:41 +01:00
parent 2c5b687cef
commit d1dee47186
2 changed files with 19 additions and 2 deletions

View File

@ -76,7 +76,7 @@ public class TestDeviceCoordinator extends AbstractDeviceCoordinator {
@Override
public String getManufacturer() {
return null;
return "Test";
}
@Override
@ -110,6 +110,8 @@ public class TestDeviceCoordinator extends AbstractDeviceCoordinator {
return UnknownDeviceSupport.class;
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_test;

View File

@ -25,7 +25,10 @@ import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public class DeviceTypeTest {
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.test.TestBase;
public class DeviceTypeTest extends TestBase {
@Test
public void ensureNoDuplicateKeys() {
final Set<Integer> knownKeys = new HashSet<>();
@ -37,4 +40,16 @@ public class DeviceTypeTest {
Assert.assertTrue("There are duplicated device keys: " + duplicateKeys, duplicateKeys.isEmpty());
}
@Test
public void ensureNoMissingDeviceInfo() {
// Check that all coordinators for all device types declare valid device names, icons and manufacturer
for (final DeviceType deviceType : DeviceType.values()) {
final DeviceCoordinator coordinator = deviceType.getDeviceCoordinator();
Assert.assertNotEquals("Device name for " + deviceType + " is 0", 0, coordinator.getDeviceNameResource());
Assert.assertNotEquals("Device icon for " + deviceType + " is 0", 0, coordinator.getDefaultIconResource());
Assert.assertNotEquals("Disabled device icon for " + deviceType + " is 0", 0, coordinator.getDisabledIconResource());
Assert.assertNotEquals("Manufacturer for " + deviceType + " is null", null, coordinator.getManufacturer());
}
}
}