From b3e88ae29ef024ce2977867e2145510b9666e8ec Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Wed, 13 Sep 2023 08:06:37 +0200 Subject: [PATCH] Java 17 features (itests) (#15583) - replace Collections by List.of and Set.of - instanceof - SAT warnings Signed-off-by: Holger Friedrich --- .../astro/handler/test/AstroCommandTest.java | 2 +- .../test/AstroValidConfigurationTest.java | 2 +- .../binding/astro/test/AstroStateTest.java | 2 +- .../test/cases/AstroBindingTestsData.java | 2 +- .../internal/config/ConfigFlowTest.java | 4 ++-- .../AbstractMieleThingHandlerTest.java | 11 +++++----- .../handler/MieleHandlerFactoryTest.java | 21 ++++++++----------- .../internal/util/OpenHabOsgiTest.java | 7 +++---- .../modbus/tests/AbstractModbusOSGiTest.java | 3 +-- .../homeassistant/DiscoverComponentsTest.java | 5 ++--- .../HomeAssistantMQTTImplementationTest.java | 13 ++++++------ .../mqtt/ruuvigateway/RuuviGatewayTest.java | 13 ++++++++---- .../ThingStatusInfoChangedSubscriber.java | 3 +-- .../openhab/binding/ntp/test/NtpOSGiTest.java | 4 ++-- .../test/WemoDiscoveryParticipantTest.java | 2 +- 15 files changed, 45 insertions(+), 49 deletions(-) diff --git a/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/handler/test/AstroCommandTest.java b/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/handler/test/AstroCommandTest.java index 60f25e70056..a7fdec32285 100644 --- a/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/handler/test/AstroCommandTest.java +++ b/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/handler/test/AstroCommandTest.java @@ -40,7 +40,7 @@ import org.openhab.core.types.State; *

* This class tests the commands for the astro thing. * - * @author Petar Valchev - Initial implementation + * @author Petar Valchev - Initial contribution * @author Svilen Valkanov - Reworked to plain unit tests * @author Christoph Weitkamp - Migrated tests to pure Java */ diff --git a/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/handler/test/AstroValidConfigurationTest.java b/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/handler/test/AstroValidConfigurationTest.java index 0229f07fcbd..29d4ad7a902 100644 --- a/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/handler/test/AstroValidConfigurationTest.java +++ b/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/handler/test/AstroValidConfigurationTest.java @@ -37,7 +37,7 @@ import org.openhab.core.thing.binding.ThingHandlerCallback; *

* This class tests the required configuration for the astro thing. * - * @author Petar Valchev - Initial implementation + * @author Petar Valchev - Initial contribution * @author Svilen Valkanov - Reworked to plain unit tests, removed irrelevant tests * @author Christoph Weitkamp - Migrated tests to pure Java */ diff --git a/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/test/AstroStateTest.java b/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/test/AstroStateTest.java index e31b8a5d9c3..e63119126dc 100644 --- a/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/test/AstroStateTest.java +++ b/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/test/AstroStateTest.java @@ -40,7 +40,7 @@ import org.openhab.core.types.State; * Tests for the Astro Channels state * * @See {@link AstroParametrizedTestCases} - * @author Petar Valchev - Initial implementation + * @author Petar Valchev - Initial contribution * @author Svilen Valkanov - Reworked to plain unit tests * @author Erdoan Hadzhiyusein - Adapted the class to work with the new DateTimeType * @author Christoph Weitkamp - Migrated tests to pure Java diff --git a/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/test/cases/AstroBindingTestsData.java b/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/test/cases/AstroBindingTestsData.java index 4ac648d5ada..d8acbeea442 100644 --- a/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/test/cases/AstroBindingTestsData.java +++ b/itests/org.openhab.binding.astro.tests/src/main/java/org/openhab/binding/astro/test/cases/AstroBindingTestsData.java @@ -17,7 +17,7 @@ import java.math.BigDecimal; /** * Contains some test data used across different tests * - * @author Svilen Valkanov - Initial implementation + * @author Svilen Valkanov - Initial contribution * @author Christoph Weitkamp - Migrated tests to pure Java */ public final class AstroBindingTestsData { diff --git a/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/config/ConfigFlowTest.java b/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/config/ConfigFlowTest.java index 2a6c3e0baac..417b723f5bc 100644 --- a/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/config/ConfigFlowTest.java +++ b/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/config/ConfigFlowTest.java @@ -61,8 +61,8 @@ public class ConfigFlowTest extends AbstractConfigFlowTest { Thing bridge = getThingRegistry().get(MieleCloudBindingIntegrationTestConstants.BRIDGE_THING_UID); assertNotNull(bridge); ThingHandler handler = bridge.getHandler(); - if (handler instanceof MieleBridgeHandler) { - ((MieleBridgeHandler) handler).onConnectionAlive(); + if (handler instanceof MieleBridgeHandler mieleBridgeHandler) { + mieleBridgeHandler.onConnectionAlive(); } return null; }).when(webservice).addConnectionStatusListener(any()); diff --git a/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/handler/AbstractMieleThingHandlerTest.java b/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/handler/AbstractMieleThingHandlerTest.java index c29a9f15c3c..0ae26d7e33b 100644 --- a/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/handler/AbstractMieleThingHandlerTest.java +++ b/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/handler/AbstractMieleThingHandlerTest.java @@ -20,8 +20,8 @@ import static org.openhab.binding.mielecloud.internal.util.MieleCloudBindingInte import static org.openhab.binding.mielecloud.internal.util.ReflectionUtil.setPrivate; import java.util.ArrayList; -import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -181,9 +181,8 @@ public abstract class AbstractMieleThingHandlerTest extends JavaOSGiTest { .create(MieleCloudBindingConstants.THING_TYPE_BRIDGE, MieleCloudBindingIntegrationTestConstants.BRIDGE_THING_UID) .withLabel("Miele@home Account") - .withConfiguration( - new Configuration(Collections.singletonMap(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, - MieleCloudBindingIntegrationTestConstants.EMAIL))) + .withConfiguration(new Configuration(Map.of(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, + MieleCloudBindingIntegrationTestConstants.EMAIL))) .build(); assertNotNull(bridge); @@ -216,8 +215,8 @@ public abstract class AbstractMieleThingHandlerTest extends JavaOSGiTest { List channels = createChannelsForThingHandler(thingTypeUid, thingUid); Thing thing = ThingBuilder.create(thingTypeUid, thingUid) - .withConfiguration(new Configuration(Collections - .singletonMap(MieleCloudBindingConstants.CONFIG_PARAM_DEVICE_IDENTIFIER, deviceIdentifier))) + .withConfiguration(new Configuration( + Map.of(MieleCloudBindingConstants.CONFIG_PARAM_DEVICE_IDENTIFIER, deviceIdentifier))) .withBridge(getBridge().getUID()).withChannels(channels).withLabel("DA-6996") .withProperty("thingTypeVersion", thingTypeVersion).build(); assertNotNull(thing); diff --git a/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/handler/MieleHandlerFactoryTest.java b/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/handler/MieleHandlerFactoryTest.java index ac7ed386a74..fbfe2a801ba 100644 --- a/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/handler/MieleHandlerFactoryTest.java +++ b/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/handler/MieleHandlerFactoryTest.java @@ -17,7 +17,7 @@ import static org.mockito.Mockito.*; import static org.openhab.binding.mielecloud.internal.util.MieleCloudBindingIntegrationTestConstants.*; import static org.openhab.binding.mielecloud.internal.util.ReflectionUtil.*; -import java.util.Collections; +import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -117,9 +117,8 @@ public class MieleHandlerFactoryTest extends JavaOSGiTest { Bridge bridge = BridgeBuilder .create(MieleCloudBindingConstants.THING_TYPE_BRIDGE, MieleCloudBindingIntegrationTestConstants.BRIDGE_THING_UID) - .withConfiguration( - new Configuration(Collections.singletonMap(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, - MieleCloudBindingIntegrationTestConstants.EMAIL))) + .withConfiguration(new Configuration(Map.of(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, + MieleCloudBindingIntegrationTestConstants.EMAIL))) .withLabel(MIELE_CLOUD_ACCOUNT_LABEL).build(); assertNotNull(bridge); @@ -141,9 +140,8 @@ public class MieleHandlerFactoryTest extends JavaOSGiTest { Bridge bridge = BridgeBuilder .create(MieleCloudBindingConstants.THING_TYPE_BRIDGE, MieleCloudBindingIntegrationTestConstants.BRIDGE_THING_UID) - .withConfiguration( - new Configuration(Collections.singletonMap(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, - MieleCloudBindingIntegrationTestConstants.EMAIL))) + .withConfiguration(new Configuration(Map.of(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, + MieleCloudBindingIntegrationTestConstants.EMAIL))) .withLabel(MIELE_CLOUD_ACCOUNT_LABEL).build(); assertNotNull(bridge); @@ -194,8 +192,8 @@ public class MieleHandlerFactoryTest extends JavaOSGiTest { // when: Thing device = ThingBuilder.create(thingTypeUid, thingUid) - .withConfiguration(new Configuration(Collections - .singletonMap(MieleCloudBindingConstants.CONFIG_PARAM_DEVICE_IDENTIFIER, DEVICE_IDENTIFIER))) + .withConfiguration(new Configuration( + Map.of(MieleCloudBindingConstants.CONFIG_PARAM_DEVICE_IDENTIFIER, DEVICE_IDENTIFIER))) .withLabel(label).withProperty("thingTypeVersion", thingTypeVersion).build(); assertNotNull(device); @@ -208,9 +206,8 @@ public class MieleHandlerFactoryTest extends JavaOSGiTest { Bridge bridge = BridgeBuilder .create(MieleCloudBindingConstants.THING_TYPE_BRIDGE, MieleCloudBindingIntegrationTestConstants.BRIDGE_THING_UID) - .withConfiguration( - new Configuration(Collections.singletonMap(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, - MieleCloudBindingIntegrationTestConstants.EMAIL))) + .withConfiguration(new Configuration(Map.of(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, + MieleCloudBindingIntegrationTestConstants.EMAIL))) .withLabel(MIELE_CLOUD_ACCOUNT_LABEL).build(); assertNotNull(bridge); diff --git a/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/util/OpenHabOsgiTest.java b/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/util/OpenHabOsgiTest.java index 046b70d7e08..9050416cdd2 100644 --- a/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/util/OpenHabOsgiTest.java +++ b/itests/org.openhab.binding.mielecloud.tests/src/main/java/org/openhab/binding/mielecloud/internal/util/OpenHabOsgiTest.java @@ -15,7 +15,7 @@ package org.openhab.binding.mielecloud.internal.util; import static org.junit.jupiter.api.Assertions.*; import static org.openhab.binding.mielecloud.internal.util.MieleCloudBindingIntegrationTestConstants.MIELE_CLOUD_ACCOUNT_LABEL; -import java.util.Collections; +import java.util.Map; import java.util.Objects; import org.eclipse.jdt.annotation.NonNullByDefault; @@ -78,9 +78,8 @@ public abstract class OpenHabOsgiTest extends JavaOSGiTest { Bridge bridge = BridgeBuilder .create(MieleCloudBindingConstants.THING_TYPE_BRIDGE, MieleCloudBindingIntegrationTestConstants.BRIDGE_THING_UID) - .withConfiguration( - new Configuration(Collections.singletonMap(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, - MieleCloudBindingIntegrationTestConstants.EMAIL))) + .withConfiguration(new Configuration(Map.of(MieleCloudBindingConstants.CONFIG_PARAM_EMAIL, + MieleCloudBindingIntegrationTestConstants.EMAIL))) .withLabel(MIELE_CLOUD_ACCOUNT_LABEL).build(); assertNotNull(bridge); diff --git a/itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/AbstractModbusOSGiTest.java b/itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/AbstractModbusOSGiTest.java index 3aaa469ed5e..f5d35deb03d 100644 --- a/itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/AbstractModbusOSGiTest.java +++ b/itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/AbstractModbusOSGiTest.java @@ -21,7 +21,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; import java.util.ArrayList; -import java.util.Collections; import java.util.Dictionary; import java.util.HashMap; import java.util.HashSet; @@ -96,7 +95,7 @@ public abstract class AbstractModbusOSGiTest extends JavaOSGiTest { @Override public Set<@NonNull String> getSubscribedEventTypes() { - return Collections.singleton(ItemStateEvent.TYPE); + return Set.of(ItemStateEvent.TYPE); } @Override diff --git a/itests/org.openhab.binding.mqtt.homeassistant.tests/src/main/java/org/openhab/binding/mqtt/homeassistant/DiscoverComponentsTest.java b/itests/org.openhab.binding.mqtt.homeassistant.tests/src/main/java/org/openhab/binding/mqtt/homeassistant/DiscoverComponentsTest.java index 7959eb21ee4..e07e7cfde00 100644 --- a/itests/org.openhab.binding.mqtt.homeassistant.tests/src/main/java/org/openhab/binding/mqtt/homeassistant/DiscoverComponentsTest.java +++ b/itests/org.openhab.binding.mqtt.homeassistant.tests/src/main/java/org/openhab/binding/mqtt/homeassistant/DiscoverComponentsTest.java @@ -15,8 +15,8 @@ package org.openhab.binding.mqtt.homeassistant; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; -import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; @@ -86,8 +86,7 @@ public class DiscoverComponentsTest extends JavaOSGiTest { DiscoverComponents discover = spy(new DiscoverComponents(ThingChannelConstants.TEST_HOME_ASSISTANT_THING, scheduler, channelStateUpdateListener, availabilityTracker, gson, transformationServiceProvider)); - HandlerConfiguration config = new HandlerConfiguration("homeassistant", - Collections.singletonList("switch/object")); + HandlerConfiguration config = new HandlerConfiguration("homeassistant", List.of("switch/object")); Set discoveryIds = new HashSet<>(); discoveryIds.addAll(HaID.fromConfig(config)); diff --git a/itests/org.openhab.binding.mqtt.homeassistant.tests/src/main/java/org/openhab/binding/mqtt/homeassistant/HomeAssistantMQTTImplementationTest.java b/itests/org.openhab.binding.mqtt.homeassistant.tests/src/main/java/org/openhab/binding/mqtt/homeassistant/HomeAssistantMQTTImplementationTest.java index 751dd3fe0bd..4bf6be8374c 100644 --- a/itests/org.openhab.binding.mqtt.homeassistant.tests/src/main/java/org/openhab/binding/mqtt/homeassistant/HomeAssistantMQTTImplementationTest.java +++ b/itests/org.openhab.binding.mqtt.homeassistant.tests/src/main/java/org/openhab/binding/mqtt/homeassistant/HomeAssistantMQTTImplementationTest.java @@ -19,10 +19,10 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ScheduledExecutorService; @@ -166,12 +166,11 @@ public class HomeAssistantMQTTImplementationTest extends MqttOSGiTest { // Start the discovery for 2000ms. Forced timeout after 4000ms. HaID haID = new HaID(testObjectTopic + "/config"); - CompletableFuture future = discover.startDiscovery(haConnection, 2000, Collections.singleton(haID), cd) - .thenRun(() -> { - }).exceptionally(e -> { - failure = e; - return null; - }); + CompletableFuture future = discover.startDiscovery(haConnection, 2000, Set.of(haID), cd).thenRun(() -> { + }).exceptionally(e -> { + failure = e; + return null; + }); assertTrue(latch.await(4, TimeUnit.SECONDS)); future.get(5, TimeUnit.SECONDS); diff --git a/itests/org.openhab.binding.mqtt.ruuvigateway.tests/src/main/java/org/openhab/binding/mqtt/ruuvigateway/RuuviGatewayTest.java b/itests/org.openhab.binding.mqtt.ruuvigateway.tests/src/main/java/org/openhab/binding/mqtt/ruuvigateway/RuuviGatewayTest.java index 60221257244..ad5d6fcf14c 100644 --- a/itests/org.openhab.binding.mqtt.ruuvigateway.tests/src/main/java/org/openhab/binding/mqtt/ruuvigateway/RuuviGatewayTest.java +++ b/itests/org.openhab.binding.mqtt.ruuvigateway.tests/src/main/java/org/openhab/binding/mqtt/ruuvigateway/RuuviGatewayTest.java @@ -385,9 +385,15 @@ public class RuuviGatewayTest extends MqttOSGiTest { } else { // test argument is only specifiying the data field in the json payload // Fill rest of the fields with some valid values - jsonPayload = "{" + " \"gw_mac\": \"DE:AD:BE:EF:00\"," + " \"rssi\": -82," + " \"aoa\": []," - + " \"gwts\": \"1659365432\"," + " \"ts\": \"1659365222\"," + " \"data\": \"" + val + "\"," - + " \"coords\": \"\" }"; + jsonPayload = """ + {\ + "gw_mac": "DE:AD:BE:EF:00",\ + "rssi": -82,\ + "aoa": [],\ + "gwts": "1659365432",\ + "ts": "1659365222",\ + "data": "\ + """ + val + "\"," + " \"coords\": \"\" }"; } Thing ruuviThing = createRuuviThing("mygwid", topic, 100); @@ -525,7 +531,6 @@ public class RuuviGatewayTest extends MqttOSGiTest { .forEach(channelId -> assertEquals(UnDefType.UNDEF, getItemState.apply(channelId))); statusUpdateIndex.incrementAndGet(); }); - } // Another mqtt update (("minimum values" test vector from diff --git a/itests/org.openhab.binding.mqtt.ruuvigateway.tests/src/main/java/org/openhab/binding/mqtt/ruuvigateway/ThingStatusInfoChangedSubscriber.java b/itests/org.openhab.binding.mqtt.ruuvigateway.tests/src/main/java/org/openhab/binding/mqtt/ruuvigateway/ThingStatusInfoChangedSubscriber.java index 9afa8b62b82..a6ad5d51970 100644 --- a/itests/org.openhab.binding.mqtt.ruuvigateway.tests/src/main/java/org/openhab/binding/mqtt/ruuvigateway/ThingStatusInfoChangedSubscriber.java +++ b/itests/org.openhab.binding.mqtt.ruuvigateway.tests/src/main/java/org/openhab/binding/mqtt/ruuvigateway/ThingStatusInfoChangedSubscriber.java @@ -14,7 +14,6 @@ package org.openhab.binding.mqtt.ruuvigateway; import static org.junit.jupiter.api.Assertions.assertInstanceOf; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -48,7 +47,7 @@ public class ThingStatusInfoChangedSubscriber implements EventSubscriber { @Override public Set<@NonNull String> getSubscribedEventTypes() { - return Collections.singleton(ThingStatusInfoChangedEvent.TYPE); + return Set.of(ThingStatusInfoChangedEvent.TYPE); } @Override diff --git a/itests/org.openhab.binding.ntp.tests/src/main/java/org/openhab/binding/ntp/test/NtpOSGiTest.java b/itests/org.openhab.binding.ntp.tests/src/main/java/org/openhab/binding/ntp/test/NtpOSGiTest.java index 1d675da2ac9..fdfc374dfab 100644 --- a/itests/org.openhab.binding.ntp.tests/src/main/java/org/openhab/binding/ntp/test/NtpOSGiTest.java +++ b/itests/org.openhab.binding.ntp.tests/src/main/java/org/openhab/binding/ntp/test/NtpOSGiTest.java @@ -22,8 +22,8 @@ import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; -import java.util.Collections; import java.util.Locale; +import java.util.Set; import java.util.TimeZone; import org.junit.jupiter.api.AfterAll; @@ -483,7 +483,7 @@ public class NtpOSGiTest extends JavaOSGiTest { initialize(configuration, channelID, acceptedItemType, null, null); EventSubscriber eventSubscriberMock = mock(EventSubscriber.class); - when(eventSubscriberMock.getSubscribedEventTypes()).thenReturn(Collections.singleton(ItemStateEvent.TYPE)); + when(eventSubscriberMock.getSubscribedEventTypes()).thenReturn(Set.of(ItemStateEvent.TYPE)); registerService(eventSubscriberMock); if (updateEventType.equals(UpdateEventType.HANDLE_COMMAND)) { diff --git a/itests/org.openhab.binding.wemo.tests/src/main/java/org/openhab/binding/wemo/internal/discovery/test/WemoDiscoveryParticipantTest.java b/itests/org.openhab.binding.wemo.tests/src/main/java/org/openhab/binding/wemo/internal/discovery/test/WemoDiscoveryParticipantTest.java index 09d92fe881e..efe52a86e46 100644 --- a/itests/org.openhab.binding.wemo.tests/src/main/java/org/openhab/binding/wemo/internal/discovery/test/WemoDiscoveryParticipantTest.java +++ b/itests/org.openhab.binding.wemo.tests/src/main/java/org/openhab/binding/wemo/internal/discovery/test/WemoDiscoveryParticipantTest.java @@ -107,7 +107,7 @@ public class WemoDiscoveryParticipantTest { assertThat(result.getThingUID(), is(new ThingUID(thingTypeUid, DEVICE_UDN))); assertThat(result.getThingTypeUID(), is(thingTypeUid)); assertThat(result.getBridgeUID(), is(nullValue())); - assertThat(result.getProperties().get(WemoBindingConstants.UDN), is(DEVICE_UDN.toString())); + assertThat(result.getProperties().get(WemoBindingConstants.UDN), is(DEVICE_UDN)); assertThat(result.getRepresentationProperty(), is(WemoBindingConstants.UDN)); } }