diff --git a/application/src/test/java/org/thingsboard/server/controller/AlarmCommentControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/AlarmCommentControllerTest.java index bebfe832e8..782580002a 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AlarmCommentControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AlarmCommentControllerTest.java @@ -231,6 +231,10 @@ public class AlarmCommentControllerTest extends AbstractControllerTest { .comment(JacksonUtil.newObjectNode().put("text", String.format("Comment was deleted by user %s", CUSTOMER_USER_EMAIL))) .build(); + // The audit log receives the persisted comment, and AlarmComment equality covers the + // inherited id and createdTime, which the builder cannot populate. + expectedAlarmComment.setId(alarmComment.getId()); + expectedAlarmComment.setCreatedTime(alarmComment.getCreatedTime()); testLogEntityActionEntityEqClass(alarm, alarm.getId(), tenantId, customerId, customerUserId, CUSTOMER_USER_EMAIL, ActionType.DELETED_COMMENT, 1, expectedAlarmComment); } @@ -255,6 +259,10 @@ public class AlarmCommentControllerTest extends AbstractControllerTest { .comment(JacksonUtil.newObjectNode().put("text", String.format("Comment was deleted by user %s", TENANT_ADMIN_EMAIL))) .build(); + // The audit log receives the persisted comment, and AlarmComment equality covers the + // inherited id and createdTime, which the builder cannot populate. + expectedAlarmComment.setId(alarmComment.getId()); + expectedAlarmComment.setCreatedTime(alarmComment.getCreatedTime()); testLogEntityActionEntityEqClass(alarm, alarm.getId(), tenantId, customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.DELETED_COMMENT, 1, expectedAlarmComment); } @@ -286,6 +294,10 @@ public class AlarmCommentControllerTest extends AbstractControllerTest { .comment(JacksonUtil.newObjectNode().put("text", String.format("Comment was deleted by user %s", TENANT_ADMIN_EMAIL))) .build(); + // The audit log receives the persisted comment, and AlarmComment equality covers the + // inherited id and createdTime, which the builder cannot populate. + expectedAlarmComment.setId(alarmComment.getId()); + expectedAlarmComment.setCreatedTime(alarmComment.getCreatedTime()); testLogEntityActionEntityEqClass(alarm, alarm.getId(), tenantId, customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.DELETED_COMMENT, 1, expectedAlarmComment); }