diff --git a/application/src/test/java/org/thingsboard/server/controller/AbstractNotifyEntityTest.java b/application/src/test/java/org/thingsboard/server/controller/AbstractNotifyEntityTest.java index 9421e33f54..9ca0ba2fd0 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AbstractNotifyEntityTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AbstractNotifyEntityTest.java @@ -360,8 +360,13 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { } private void testSendNotificationMsgToEdgeServiceTimeEntityEqAny(TenantId tenantId, ActionType actionType, int cntTime) { + // Count only entities that can be synced to edge. Background services may save non-edge entities for the + // tenant at any moment (e.g. QUEUE_STATS created by the periodic rule engine stats report), and their + // ADDED notifications have no edge event type, so they are dropped by TbClusterService anyway. + ArgumentMatcher matcherEdgeEntityId = argument -> argument != null + && EdgeUtils.getEdgeEventTypeByEntityType(argument.getEntityType()) != null; Mockito.verify(tbClusterService, times(cntTime)).sendNotificationMsgToEdge(Mockito.eq(tenantId), - Mockito.any(), Mockito.any(EntityId.class), Mockito.any(), Mockito.isNull(), + Mockito.any(), Mockito.argThat(matcherEdgeEntityId), Mockito.any(), Mockito.isNull(), Mockito.eq(EdgeUtils.getEdgeEventActionTypeByActionType(actionType)), Mockito.any()); }