1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 05:16:51 +01:00

Fix unit tests

This commit is contained in:
José Rebelo 2023-10-28 15:53:47 +01:00
parent dc825c87e7
commit 3d8ae8596c
2 changed files with 1 additions and 19 deletions

View File

@ -88,7 +88,7 @@ public class EntitiesTest extends TestBase {
assertEquals("00:00:00:00:01", device.getIdentifier());
assertEquals("Testie", device.getName());
assertEquals("4.0", device.getModel());
assertEquals(DeviceType.TEST.getKey(), device.getType());
assertEquals(DeviceType.TEST.name(), device.getTypeName());
DeviceAttributes attributes = device.getDeviceAttributesList().get(0);
assertNotNull(attributes);
assertEquals("1.2.3", attributes.getFirmwareVersion1());

View File

@ -19,28 +19,10 @@ package nodomain.freeyourgadget.gadgetbridge.model;
import org.junit.Assert;
import org.junit.Test;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
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<>();
final List<Integer> duplicateKeys = Arrays.stream(DeviceType.values())
.map(DeviceType::getKey)
.filter(k -> !knownKeys.add(k))
.collect(Collectors.toList());
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