[dsmr] Fix test after openhab-core change #2126 (#9900)

PortInUseException interface changed.

Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
This commit is contained in:
Hilbrand Bouwkamp 2021-01-21 16:41:36 +01:00 committed by GitHub
parent a693a4ed64
commit 0fc60d82c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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();