From e005462fcd64307cb829028660ee175eff0550b0 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Wed, 26 Nov 2025 17:27:56 +0200 Subject: [PATCH] Make test more logical --- .../service/notification/NotificationRuleApiTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/service/notification/NotificationRuleApiTest.java b/application/src/test/java/org/thingsboard/server/service/notification/NotificationRuleApiTest.java index 3f7adec118..569bed718e 100644 --- a/application/src/test/java/org/thingsboard/server/service/notification/NotificationRuleApiTest.java +++ b/application/src/test/java/org/thingsboard/server/service/notification/NotificationRuleApiTest.java @@ -855,19 +855,19 @@ public class NotificationRuleApiTest extends AbstractNotificationApiTest { public void testNotificationsResourcesShortage_whenThresholdChangeToMatchingFilter_thenSendNotification() throws Exception { loginSysAdmin(); ResourcesShortageNotificationRuleTriggerConfig triggerConfig = ResourcesShortageNotificationRuleTriggerConfig.builder() - .ramThreshold(1f) - .cpuThreshold(1f) - .storageThreshold(1f) + .ramThreshold(0.99f) + .cpuThreshold(0.99f) + .storageThreshold(0.99f) .build(); NotificationRule rule = createNotificationRule(triggerConfig, "Warning: ${resource} shortage", "${resource} shortage", createNotificationTarget(tenantAdminUserId).getId()); loginTenantAdmin(); - // Mock SystemUtil to return 15% usages (not exceeds 100% threshold) + // Mock SystemUtil to return 15% usages (not exceeds 99% threshold) Method method; try (MockedStatic mockedSystemUtil = mockStatic(SystemUtil.class)) { mockedSystemUtil.when(SystemUtil::getMemoryUsage).thenReturn(Optional.of(15)); mockedSystemUtil.when(SystemUtil::getCpuUsage).thenReturn(Optional.of(15)); - mockedSystemUtil.when(SystemUtil::getDiscSpaceUsage).thenReturn(Optional.of(15L)); + mockedSystemUtil.when(SystemUtil::getDiscSpaceUsage).thenReturn(Optional.of(15)); method = DefaultSystemInfoService.class.getDeclaredMethod("saveCurrentMonolithSystemInfo"); method.setAccessible(true);