]> git.basschouten.com Git - openhab-addons.git/commitdiff
[dsmr] Fix test after openhab-core change #2126 (#9900)
authorHilbrand Bouwkamp <hilbrand@h72.nl>
Thu, 21 Jan 2021 15:41:36 +0000 (16:41 +0100)
committerGitHub <noreply@github.com>
Thu, 21 Jan 2021 15:41:36 +0000 (16:41 +0100)
PortInUseException interface changed.

Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
bundles/org.openhab.binding.dsmr/src/test/java/org/openhab/binding/dsmr/internal/device/DSMRSerialAutoDeviceTest.java

index 8738c1d0b7becb3a114285e256ac7244fa97baed..33d635c85848428212ad3e68e7b5bc2ccbdc01af 100644 (file)
@@ -132,9 +132,8 @@ public class DSMRSerialAutoDeviceTest {
         try (InputStream inputStream = new ByteArrayInputStream(new byte[] {})) {
             when(mockSerialPort.getInputStream()).thenReturn(inputStream);
             // Trigger device to go into error stage with port in use.
-            doAnswer(a -> {
-                throw new PortInUseException();
-            }).when(mockIdentifier).open(eq(DSMRBindingConstants.DSMR_PORT_NAME), anyInt());
+            doThrow(new PortInUseException(new Exception())).when(mockIdentifier)
+                    .open(eq(DSMRBindingConstants.DSMR_PORT_NAME), anyInt());
             DSMRSerialAutoDevice device = new DSMRSerialAutoDevice(serialPortManager, DUMMY_PORTNAME, listener,
                     new DSMRTelegramListener(), scheduler, 1);
             device.start();