]> git.basschouten.com Git - openhab-addons.git/commitdiff
fix junit status race condition (#16886)
authorBernd Weymann <bernd.weymann@gmail.com>
Tue, 18 Jun 2024 05:55:00 +0000 (07:55 +0200)
committerGitHub <noreply@github.com>
Tue, 18 Jun 2024 05:55:00 +0000 (07:55 +0200)
Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com>
bundles/org.openhab.binding.pegelonline/src/test/java/org/openhab/binding/pegelonline/internal/handler/PegelTest.java

index 7a007ff027a0460c24ee1744226fd267e8ec32de..5e7936e55f7c66ffe81f2da0aaad7b4d036a98e8 100644 (file)
@@ -247,11 +247,20 @@ class PegelTest {
 
         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();