diff --git a/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java b/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java index 6f31d5505d..919c0884ca 100644 --- a/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java @@ -719,8 +719,11 @@ class DefaultIotHubServiceTest { when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any())) .thenReturn(new PageData<>(List.of(deleted), 1, 1, false)); // Found, so only the use-existing rule keeps it - lenient().when(dashboardService.findDashboardById(tenantId, usersDashboardId)).thenReturn(new Dashboard(usersDashboardId)); + Dashboard usersDashboard = new Dashboard(usersDashboardId); + usersDashboard.setTenantId(tenantId); + lenient().when(dashboardService.findDashboardById(tenantId, usersDashboardId)).thenReturn(usersDashboard); Device device = new Device(deviceId); + device.setTenantId(tenantId); when(deviceService.findDeviceById(tenantId, deviceId)).thenReturn(device); service.deleteInstalledItem(user, deleted.getId()); @@ -737,6 +740,9 @@ class DefaultIotHubServiceTest { when(iotHubInstalledItemService.findById(tenantId, checked.getId())).thenReturn(checked); when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any())) .thenReturn(new PageData<>(List.of(checked), 1, 1, false)); + Dashboard usersDashboard = new Dashboard(usersDashboardId); + usersDashboard.setTenantId(tenantId); + lenient().when(dashboardService.findDashboardById(tenantId, usersDashboardId)).thenReturn(usersDashboard); when(entityService.fetchEntityName(tenantId, usersDashboardId)).thenReturn(Optional.of("My dashboard")); InstalledItemKeptEntities kept = service.findKeptEntities(tenantId, checked.getId());