Browse Source

test(iot-hub): the removeEntities save failure uses an exception every branch has

pull/16553/head
dpinkevych 4 weeks ago
parent
commit
04c57bba9c
  1. 3
      application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java

3
application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java

@ -24,7 +24,6 @@ import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.iot_hub.DeviceInstalledItemDescriptor;
import org.thingsboard.server.common.data.iot_hub.IotHubInstalledItem;
import org.thingsboard.server.common.data.iot_hub.RuleChainInstalledItemDescriptor;
import org.thingsboard.server.dao.exception.DataValidationException;
import org.thingsboard.server.dao.dashboard.DashboardService;
import org.thingsboard.server.dao.device.DeviceProfileService;
import org.thingsboard.server.dao.device.DeviceService;
@ -711,7 +710,7 @@ class DefaultIotHubServiceTest {
when(iotHubRestClient.getVersionInfo(newVersionId))
.thenReturn(version(newVersionId, item.getItemId().toString(), "DEVICE", "Gateway", "1.0.2"));
when(deviceService.findDeviceById(tenantId, device.getId())).thenReturn(device);
doThrow(new DataValidationException("invalid item")).when(iotHubInstalledItemService).save(tenantId, item);
doThrow(new IllegalArgumentException("invalid item")).when(iotHubInstalledItemService).save(tenantId, item);
// The device is already removed: the failure must not look like a refusal (a 400) to the wizard.
assertThatThrownBy(() -> service.removeDevicePackageEntities(user, item.getId(), newVersionId))

Loading…
Cancel
Save