Fix bluetooth unit tests (#8620)
Fixes: #8538 Signed-off-by: Connor Petty <mistercpp2000+gitsignoff@gmail.com>
This commit is contained in:
parent
fbafc365da
commit
515658de7f
bundles/org.openhab.binding.bluetooth/src
main/java/org/openhab/binding/bluetooth/discovery/internal
test/java/org/openhab/binding/bluetooth
@ -267,6 +267,10 @@ public class BluetoothDiscoveryService extends AbstractDiscoveryService implemen
|
||||
future = future.thenApply(result -> {
|
||||
publishDiscoveryResult(adapter, result);
|
||||
return result;
|
||||
}).whenComplete((r, t) -> {
|
||||
if (t != null) {
|
||||
logger.warn("Error occured during discovery of {}", device.getAddress(), t);
|
||||
}
|
||||
});
|
||||
|
||||
// now save this snapshot for later
|
||||
|
@ -35,6 +35,6 @@ public class TestUtils {
|
||||
}
|
||||
|
||||
public static ThingUID randomThingUID() {
|
||||
return new ThingUID("mock", RandomStringUtils.randomAlphabetic(6));
|
||||
return new ThingUID(BluetoothBindingConstants.BINDING_ID, RandomStringUtils.randomAlphabetic(6));
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
@ -66,7 +65,6 @@ import org.slf4j.LoggerFactory;
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.WARN)
|
||||
@NonNullByDefault
|
||||
@Disabled("Needs to be updated for OH3")
|
||||
public class BluetoothDiscoveryServiceTest {
|
||||
|
||||
private static final int TIMEOUT = 2000;
|
||||
@ -541,7 +539,8 @@ public class BluetoothDiscoveryServiceTest {
|
||||
private ThingTypeUID typeUID;
|
||||
|
||||
public MockDiscoveryParticipant() {
|
||||
this.typeUID = new ThingTypeUID("mock", RandomStringUtils.randomAlphabetic(6));
|
||||
this.typeUID = new ThingTypeUID(BluetoothBindingConstants.BINDING_ID,
|
||||
RandomStringUtils.randomAlphabetic(6));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -551,8 +550,9 @@ public class BluetoothDiscoveryServiceTest {
|
||||
|
||||
@Override
|
||||
public @Nullable DiscoveryResult createResult(BluetoothDiscoveryDevice device) {
|
||||
String repProp = RandomStringUtils.randomAlphabetic(6);
|
||||
return DiscoveryResultBuilder.create(getThingUID(device)).withLabel(RandomStringUtils.randomAlphabetic(6))
|
||||
.withRepresentationProperty(RandomStringUtils.randomAlphabetic(6))
|
||||
.withProperty(repProp, RandomStringUtils.randomAlphabetic(6)).withRepresentationProperty(repProp)
|
||||
.withBridge(device.getAdapter().getUID()).build();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user