[mqtt][tradfri][webthing] Adapt to ColorUtil changes in core (#14810)

* [mqtt][tradfri][webthing] Adapt to ColorUtil changes in core

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
Holger Friedrich
2023-04-21 23:55:36 +02:00
committed by GitHub
parent cf3c3f1025
commit 428ccbe075
6 changed files with 57 additions and 31 deletions

View File

@@ -12,7 +12,7 @@
*/
package org.openhab.binding.webthing.internal.link;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
import java.net.URI;
@@ -185,7 +185,12 @@ public class WebthingChannelLinkTest {
message.data = Map.of(propertyName, initialValue);
websocketConnectionFactory.webSocketRef.get().sendToClient(message);
assertEquals(initialState, testWebthingThingHandler.itemState.get(channelUID));
Command actualState = testWebthingThingHandler.itemState.get(channelUID);
if ((actualState instanceof HSBType actualHsb) && (initialState instanceof HSBType initialStateHsb)) {
assertTrue(actualHsb.closeTo(initialStateHsb, 0.01));
} else {
assertEquals(initialState, actualState);
}
ChannelToPropertyLink.establish(testWebthingThingHandler, channel, webthing, propertyName);
testWebthingThingHandler.listeners.get(channelUID).onItemStateChanged(channelUID, updatedState);