From 705efe8727902ea0f9cf0eca40726e9cec2948d6 Mon Sep 17 00:00:00 2001 From: Bernd Weymann Date: Tue, 18 Jun 2024 07:55:00 +0200 Subject: [PATCH] fix junit status race condition (#16886) Signed-off-by: Bernd Weymann --- .../internal/handler/PegelTest.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bundles/org.openhab.binding.pegelonline/src/test/java/org/openhab/binding/pegelonline/internal/handler/PegelTest.java b/bundles/org.openhab.binding.pegelonline/src/test/java/org/openhab/binding/pegelonline/internal/handler/PegelTest.java index 7a007ff027a04..5e7936e55f7c6 100644 --- a/bundles/org.openhab.binding.pegelonline/src/test/java/org/openhab/binding/pegelonline/internal/handler/PegelTest.java +++ b/bundles/org.openhab.binding.pegelonline/src/test/java/org/openhab/binding/pegelonline/internal/handler/PegelTest.java @@ -247,11 +247,20 @@ public void testInconsistentLevels() { tsi = callback.getThingStatus(); assertNotNull(tsi); - assertEquals(ThingStatus.UNKNOWN, tsi.getStatus(), "Status"); - assertEquals(ThingStatusDetail.NONE, tsi.getStatusDetail(), "Detail"); - description = tsi.getDescription(); - assertNotNull(description); - assertEquals("@text/pegelonline.handler.status.wait-feedback", description, "Description"); + // In function initialize scheduler is started. + // If schedule took place status is ONLINE else UNKNOWN + switch (tsi.getStatus()) { + case UNKNOWN: + assertEquals(ThingStatusDetail.NONE, tsi.getStatusDetail(), "Detail"); + description = tsi.getDescription(); + assertNotNull(description); + assertEquals("@text/pegelonline.handler.status.wait-feedback", description, "Description"); + break; + case ONLINE: + break; + default: + fail(); + } handler.dispose(); config = new Configuration();