]> git.basschouten.com Git - openhab-addons.git/commitdiff
[modbus] Re-enable itests after core change (#15017)
authorHolger Friedrich <holgerfriedrich@users.noreply.github.com>
Tue, 23 May 2023 06:04:00 +0000 (08:04 +0200)
committerGitHub <noreply@github.com>
Tue, 23 May 2023 06:04:00 +0000 (08:04 +0200)
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/AbstractModbusOSGiTest.java
itests/pom.xml

index 11ad6a941f79d34ca24007d88a11673d06afd4fb..3aaa469ed5eeba3750cd43a8347c18e43d9563b9 100644 (file)
@@ -45,6 +45,7 @@ import org.openhab.binding.modbus.internal.ModbusHandlerFactory;
 import org.openhab.core.events.Event;
 import org.openhab.core.events.EventFilter;
 import org.openhab.core.events.EventSubscriber;
+import org.openhab.core.i18n.UnitProvider;
 import org.openhab.core.io.transport.modbus.ModbusCommunicationInterface;
 import org.openhab.core.io.transport.modbus.ModbusManager;
 import org.openhab.core.items.Item;
@@ -118,6 +119,7 @@ public abstract class AbstractModbusOSGiTest extends JavaOSGiTest {
     private final Logger logger = LoggerFactory.getLogger(AbstractModbusOSGiTest.class);
 
     protected @Mock @NonNullByDefault({}) ModbusManager mockedModbusManager;
+    protected @Mock @NonNullByDefault({}) UnitProvider mockedUnitProvider;
     protected @NonNullByDefault({}) ModbusManager realModbusManager;
     protected @NonNullByDefault({}) ManagedThingProvider thingProvider;
     protected @NonNullByDefault({}) ManagedItemProvider itemProvider;
@@ -156,7 +158,7 @@ public abstract class AbstractModbusOSGiTest extends JavaOSGiTest {
         itemChannelLinkRegistry = getService(ItemChannelLinkRegistry.class);
         assertThat("Could not get ItemChannelLinkRegistry", itemChannelLinkRegistry, is(notNullValue()));
 
-        coreItemFactory = new CoreItemFactory();
+        coreItemFactory = new CoreItemFactory(mockedUnitProvider);
 
         // Clean slate for all tests
         reset(mockedModbusManager);
index 50c3ae5176ecc7f9294e54d58054ec8887a318f2..f404ec305a94ebe3f83cc2292b4786756a94f7a1 100644 (file)
@@ -25,9 +25,7 @@
     <module>org.openhab.binding.hue.tests</module>
     <module>org.openhab.binding.max.tests</module>
     <module>org.openhab.binding.mielecloud.tests</module>
-    <!-- Modbus tests disabled until fixed (CoreItemFactory)
-      <module>org.openhab.binding.modbus.tests</module>
-    -->
+    <module>org.openhab.binding.modbus.tests</module>
     <module>org.openhab.binding.mqtt.homeassistant.tests</module>
     <module>org.openhab.binding.mqtt.homie.tests</module>
     <!-- MQTT ruuvigateway tests disabled until fixed (CoreItemFactory + NumberItem)