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