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 30b03ead3a..8e2335c042 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AbstractNotifyEntityTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AbstractNotifyEntityTest.java @@ -109,7 +109,8 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { EntityId entity_originator_NULL_UUID = createEntityId_NULL_UUID(entity); testNotificationMsgToEdgeServiceNever(entity_originator_NULL_UUID); ArgumentMatcher matcherEntityEquals = argument -> argument.getClass().equals(entity.getClass()); - ArgumentMatcher matcherError = argument -> argument.getMessage().contains(exp.getMessage()); + ArgumentMatcher matcherError = argument -> argument.getMessage().contains(exp.getMessage()) + & argument.getClass().equals(exp.getClass()); logEntityActionErrorAdditionalInfo(matcherEntityEquals, entity_originator_NULL_UUID, tenantId, customer_NULL_UUID, userId, userName, actionType, 1, matcherError, additionalInfo); testPushMsgToRuleEngineNever(entity_originator_NULL_UUID); @@ -122,8 +123,10 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { EntityId entity_originator_NULL_UUID = createEntityId_NULL_UUID(entity); testNotificationMsgToEdgeServiceNever(entity_originator_NULL_UUID); ArgumentMatcher matcherEntityIsNull = Objects::isNull; - ArgumentMatcher matcherError = argument -> argument.getMessage().contains(exp.getMessage()) & argument.getClass().equals(exp.getClass()); - logEntityActionErrorAdditionalInfo(matcherEntityIsNull, entity_originator_NULL_UUID, tenantId, customer_NULL_UUID, userId, userName, actionType, 1, matcherError, additionalInfo); + ArgumentMatcher matcherError = argument -> argument.getMessage().contains(exp.getMessage()) & + argument.getClass().equals(exp.getClass()); + logEntityActionErrorAdditionalInfo(matcherEntityIsNull, entity_originator_NULL_UUID, tenantId, customer_NULL_UUID, + userId, userName, actionType, 1, matcherError, additionalInfo); testPushMsgToRuleEngineNever(entity_originator_NULL_UUID); } @@ -174,11 +177,12 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { ActionType actionType, int cntTime, Object... additionalInfo) { ArgumentMatcher matcherEntityEquals = argument -> argument.equals(entity); ArgumentMatcher matcherOriginatorId = argument -> argument.equals(originatorId); - logEntityActionAdditionalInfo(matcherEntityEquals, matcherOriginatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); + logEntityActionAdditionalInfo(matcherEntityEquals, matcherOriginatorId, tenantId, customerId, userId, userName, + actionType, cntTime, additionalInfo); } - private void logEntityActionAdditionalInfo(ArgumentMatcher matcherEntity, ArgumentMatcher matcherOriginatorId, TenantId tenantId, - CustomerId customerId, UserId userId, String userName, + private void logEntityActionAdditionalInfo(ArgumentMatcher matcherEntity, ArgumentMatcher matcherOriginatorId, + TenantId tenantId, CustomerId customerId, UserId userId, String userName, ActionType actionType, int cntTime, Object... additionalInfo) { switch (additionalInfo.length) { case 1: @@ -234,8 +238,8 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { } private void logEntityActionErrorAdditionalInfo(ArgumentMatcher matcherEntity, EntityId originatorId, TenantId tenantId, - CustomerId customerId, UserId userId, String userName, - ActionType actionType, int cntTime, ArgumentMatcher matcherError, Object... additionalInfo) { + CustomerId customerId, UserId userId, String userName, ActionType actionType, + int cntTime, ArgumentMatcher matcherError, Object... additionalInfo) { switch (additionalInfo.length) { case 1: Mockito.verify(auditLogService, times(cntTime)) @@ -261,6 +265,19 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { Mockito.argThat(matcherError), Mockito.eq(extractParameter(String.class, 0, additionalInfo)), Mockito.eq(extractParameter(String.class, 1, additionalInfo))); + case 3: + Mockito.verify(auditLogService, times(cntTime)) + .logEntityAction(Mockito.eq(tenantId), + Mockito.eq(customerId), + Mockito.eq(userId), + Mockito.eq(userName), + Mockito.eq(originatorId), + Mockito.argThat(matcherEntity), + Mockito.eq(actionType), + Mockito.argThat(matcherError), + Mockito.eq(extractParameter(String.class, 0, additionalInfo)), + Mockito.eq(extractParameter(String.class, 1, additionalInfo)), + Mockito.eq(extractParameter(String.class, 3, additionalInfo))); break; default: Mockito.verify(auditLogService, times(cntTime))