org.openhab.core.test;version='[3.0.0,3.0.1)',\
org.openhab.core.thing;version='[3.0.0,3.0.1)',\
org.openhab.core.thing.xml;version='[3.0.0,3.0.1)',\
- org.opentest4j;version='[1.2.0,1.2.1)'
+ org.opentest4j;version='[1.2.0,1.2.1)',\
+ org.eclipse.jdt.annotation;version='[2.2.100,2.2.101)'
*/
package org.openhab.binding.hue.internal.handler;
+import static org.eclipse.jdt.annotation.Checks.requireNonNull;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.*;
*/
public class HueBridgeHandlerOSGiTest extends AbstractHueOSGiTestParent {
- private final ThingTypeUID BRIDGE_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "bridge");
+ private static final ThingTypeUID BRIDGE_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "bridge");
private static final String TEST_USER_NAME = "eshTestUser";
private static final String DUMMY_HOST = "1.2.3.4";
hueBridgeHandler.onNotAuthenticated();
assertEquals("notAuthenticatedUser", bridge.getConfiguration().get(USER_NAME));
- assertEquals(ThingStatus.OFFLINE, bridge.getStatus());
+ waitForAssert(() -> assertEquals(ThingStatus.OFFLINE, bridge.getStatus()));
assertEquals(ThingStatusDetail.OFFLINE.CONFIGURATION_ERROR, bridge.getStatusInfo().getStatusDetail());
}
hueBridgeHandler.onNotAuthenticated();
assertNull(bridge.getConfiguration().get(USER_NAME));
- assertEquals(ThingStatus.OFFLINE, bridge.getStatus());
+ waitForAssert(() -> assertEquals(ThingStatus.OFFLINE, bridge.getStatus()));
assertEquals(ThingStatusDetail.OFFLINE.CONFIGURATION_ERROR, bridge.getStatusInfo().getStatusDetail());
}
hueBridgeHandler.onNotAuthenticated();
assertNull(bridge.getConfiguration().get(USER_NAME));
- assertEquals(ThingStatus.OFFLINE, bridge.getStatus());
+ waitForAssert(() -> assertEquals(ThingStatus.OFFLINE, bridge.getStatus()));
assertEquals(ThingStatusDetail.OFFLINE.CONFIGURATION_ERROR, bridge.getStatusInfo().getStatusDetail());
}
hueBridgeHandler.onConnectionLost();
- assertEquals(ThingStatus.OFFLINE, bridge.getStatus());
+ waitForAssert(() -> assertEquals(ThingStatus.OFFLINE, bridge.getStatus()));
assertNotEquals(ThingStatusDetail.BRIDGE_OFFLINE, bridge.getStatusInfo().getStatusDetail());
}
Bridge bridge = (Bridge) thingRegistry.createThingOfType(BRIDGE_THING_TYPE_UID,
new ThingUID(BRIDGE_THING_TYPE_UID, "testBridge"), null, "Bridge", configuration);
- assertNotNull(bridge);
+ bridge = requireNonNull(bridge, "Bridge is null");
thingRegistry.add(bridge);
return bridge;
}