Skip to content

Commit 21ab80a

Browse files
committed
Updating mockio and adding NPE checks
1 parent 41dd100 commit 21ab80a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pubber/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,5 @@ dependencies {
122122
implementation 'org.slf4j:slf4j-simple:1.7.30'
123123
implementation 'org.bouncycastle:bcpkix-jdk15on:1.64'
124124
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
125-
testImplementation 'org.mockito:mockito-core:3.11.2'
125+
testImplementation 'org.mockito:mockito-core:5.3.1'
126126
}

udmis/src/main/java/com/google/bos/udmi/service/access/ClearBladeIotAccessProvider.java

+4
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ private CloudModel bindDevicesToGateway(String registryId, String gatewayId,
261261

262262
private void checkBoundState(String registryId, String gatewayId, Set<String> deviceIds,
263263
Consumer<String> progress) {
264+
requireNonNull(progress, "checkBoundState has null progress");
264265
CloudModel cloudModel = listRegistryDevices(registryId, gatewayId, progress);
265266
List<String> proxyIds = cloudModel.gateway.proxy_ids;
266267
progress.accept(format("Found %d devices bound to gateway %s.", proxyIds.size(), gatewayId));
@@ -422,6 +423,7 @@ private HashMap<String, CloudModel> fetchDevices(String deviceRegistryId, String
422423

423424
private HashMap<String, CloudModel> fetchDevices(String deviceRegistryId,
424425
Consumer<String> progress, GatewayListOptions gatewayListOptions) {
426+
requireNonNull(progress, "fetchDevices has null progress");
425427
String location = getRegistryLocation(deviceRegistryId);
426428
String registryFullName =
427429
RegistryName.of(projectId, location, deviceRegistryId).getRegistryFullName();
@@ -553,6 +555,7 @@ private CloudModel listRegistryDevices(String registryId, String gatewayId,
553555

554556
private Map<String, CloudModel> augmentGatewayModels(String registryId,
555557
HashMap<String, CloudModel> boundDevices, Consumer<String> progress) {
558+
requireNonNull(progress, "augmentGatewayModels has null progress");
556559
HashMap<String, String> proxyDeviceGateways = new HashMap<>();
557560
Set<Entry<String, CloudModel>> gateways =
558561
boundDevices.entrySet().stream().filter(this::isGateway).collect(Collectors.toSet());
@@ -741,6 +744,7 @@ private CloudModel unbindAndDeleteCore(String registryId, Device device, Set<Str
741744

742745
private void bindDevicesGateways(String registryId, Set<String> gatewayIds,
743746
Set<String> deviceIds, boolean toBind, Consumer<String> progress) {
747+
requireNonNull(progress, "bindDevicesGateways has null progress");
744748
String opCode = toBind ? "Binding" : "Unbinding";
745749
info("%s %s: gateways %s devices %s", opCode, registryId, gatewayIds, deviceIds);
746750
AtomicInteger opCount = new AtomicInteger(0);

0 commit comments

Comments
 (0)