From d79726addfb065ff9868f152939702dd8e549919 Mon Sep 17 00:00:00 2001 From: Pierre GAUFILLET Date: Sat, 25 May 2024 17:17:01 +0200 Subject: [PATCH] Add thing discovery match test with blank and invisible characters. --- .../binding/zigbee/internal/ZigBeeThingTypeMatcherTest.java | 6 ++++++ org.openhab.binding.zigbee/src/test/resources/discovery.txt | 1 + 2 files changed, 7 insertions(+) diff --git a/org.openhab.binding.zigbee/src/test/java/org/openhab/binding/zigbee/internal/ZigBeeThingTypeMatcherTest.java b/org.openhab.binding.zigbee/src/test/java/org/openhab/binding/zigbee/internal/ZigBeeThingTypeMatcherTest.java index 14d284a7a..66d744b60 100644 --- a/org.openhab.binding.zigbee/src/test/java/org/openhab/binding/zigbee/internal/ZigBeeThingTypeMatcherTest.java +++ b/org.openhab.binding.zigbee/src/test/java/org/openhab/binding/zigbee/internal/ZigBeeThingTypeMatcherTest.java @@ -61,5 +61,11 @@ public void testMatcher() properties = new HashMap<>(); properties.put(Thing.PROPERTY_VENDOR, "Vendor3"); assertEquals(null, matcher.matchThingType(properties)); + + // Match with invisible characters + properties = new HashMap<>(); + properties.put(Thing.PROPERTY_VENDOR, "Vendor4"); + properties.put(Thing.PROPERTY_MODEL_ID, "Model3"); + assertEquals(new ThingTypeUID("zigbee:type5"), matcher.matchThingType(properties)); } } diff --git a/org.openhab.binding.zigbee/src/test/resources/discovery.txt b/org.openhab.binding.zigbee/src/test/resources/discovery.txt index 462d4454f..d1b282b31 100644 --- a/org.openhab.binding.zigbee/src/test/resources/discovery.txt +++ b/org.openhab.binding.zigbee/src/test/resources/discovery.txt @@ -3,3 +3,4 @@ type1,vendor=Vendor1,modelId=Model1 type2,vendor=Vendor2,modelId=Model2 type3,vendor=Vendor1,modelId=Model2 type4,vendor=Vendor1,modelId=Model2,firmwareVersion=Version4 +type5,vendor=\u001F Vendor4,modelId= Model3\u001F