From 0aedc615a73a4874c7ffd540b16f878b1e44023f Mon Sep 17 00:00:00 2001 From: dshvaika Date: Wed, 18 Nov 2026 16:40:00 +0200 Subject: [PATCH] IoT Hub device package delete tests: the entities of an install made before 4.4.1 belong to the tenant, as in the sibling tests --- .../server/service/iot_hub/DefaultIotHubServiceTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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());