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)); } }