From e2e6f44d6b44556bedede0e755b899af1c14a5d8 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Wed, 11 Mar 2026 14:05:17 +0200 Subject: [PATCH] Fix stale test after notification request cleanup refactoring --- .../service/ttl/NotificationsCleanUpServiceTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/service/ttl/NotificationsCleanUpServiceTest.java b/application/src/test/java/org/thingsboard/server/service/ttl/NotificationsCleanUpServiceTest.java index 645eb600a4..d74652325a 100644 --- a/application/src/test/java/org/thingsboard/server/service/ttl/NotificationsCleanUpServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/ttl/NotificationsCleanUpServiceTest.java @@ -125,15 +125,20 @@ public class NotificationsCleanUpServiceTest { } @Test - public void testNoPartitionsDropped_skipsRequestCleanup() { + public void testNoPartitionsDropped_stillCleansUpRequests() { TopicPartitionInfo myPartition = TopicPartitionInfo.builder().topic("tb_core").myPartition(true).build(); when(partitionService.resolve(any(), any(), any())).thenReturn(myPartition); when(partitioningRepository.dropPartitionsBefore(anyString(), anyLong(), anyLong())) .thenReturn(0L); + when(notificationRequestDao.removeByTenantIdAndCreatedTimeBeforeBatch(eq(TenantId.SYS_TENANT_ID), anyLong(), eq(BATCH_SIZE))) + .thenReturn(0); + when(tenantService.findTenantsIds(any())) + .thenReturn(new PageData<>(List.of(), 0, 0, false)); + cleanUpService.cleanUp(); - verify(notificationRequestDao, never()).removeByTenantIdAndCreatedTimeBeforeBatch(any(), anyLong(), anyInt()); + verify(notificationRequestDao).removeByTenantIdAndCreatedTimeBeforeBatch(eq(TenantId.SYS_TENANT_ID), anyLong(), eq(BATCH_SIZE)); } }