Assert.assertEquals(auditLogsWithHistory.size(), 1); final AccountModelDao history1 = (AccountModelDao) auditLogsWithHistory.get(0).getEntity(); Assert.assertEquals(auditLogsWithHistory.get(0).getChangeType(), ChangeType.INSERT); Assert.assertEquals(history1.getAccountRecordId(), createdAccount.getRecordId()); Assert.assertEquals(auditLogsWithHistory.size(), 2); final AccountModelDao history2 = (AccountModelDao) auditLogsWithHistory.get(1).getEntity(); Assert.assertEquals(auditLogsWithHistory.get(0).getChangeType(), ChangeType.INSERT); Assert.assertEquals(auditLogsWithHistory.get(1).getChangeType(), ChangeType.UPDATE); Assert.assertEquals(auditLogsWithHistory.size(), 3); final AccountModelDao history3 = (AccountModelDao) auditLogsWithHistory.get(2).getEntity(); Assert.assertEquals(auditLogsWithHistory.get(0).getChangeType(), ChangeType.INSERT); Assert.assertEquals(auditLogsWithHistory.get(1).getChangeType(), ChangeType.UPDATE);
public AuditLogJson(final AuditLogWithHistory auditLogWithHistory) { this(auditLogWithHistory.getChangeType().toString(), auditLogWithHistory.getCreatedDate(), auditLogWithHistory.getAuditedObjectType(), auditLogWithHistory.getAuditedEntityId(), auditLogWithHistory.getUserName(), auditLogWithHistory.getReasonCode(), auditLogWithHistory.getComment(), auditLogWithHistory.getUserToken(), auditLogWithHistory.getEntity()); }
Assert.assertEquals(auditLogsWithHistory.size(), 1); PaymentMethodModelDao history1 = (PaymentMethodModelDao) auditLogsWithHistory.get(0).getEntity(); Assert.assertEquals(auditLogsWithHistory.get(0).getChangeType(), ChangeType.INSERT); Assert.assertEquals(history1.getAccountRecordId(), paymentMethodModelDao.getAccountRecordId()); Assert.assertEquals(auditLogsWithHistory.size(), 2); history1 = (PaymentMethodModelDao) auditLogsWithHistory.get(0).getEntity(); PaymentMethodModelDao history2 = (PaymentMethodModelDao) auditLogsWithHistory.get(1).getEntity(); Assert.assertEquals(auditLogsWithHistory.get(0).getChangeType(), ChangeType.INSERT); Assert.assertEquals(history1.getAccountRecordId(), paymentMethodModelDao.getAccountRecordId());
Assert.assertEquals(paymentTransactionHistoryAfterJanitor.size(), 4); PaymentTransactionModelDao history3 = (PaymentTransactionModelDao) paymentTransactionHistoryAfterJanitor.get(3).getEntity(); Assert.assertEquals(history3.getTransactionStatus(), TransactionStatus.PAYMENT_FAILURE);
Assert.assertEquals(auditLogsWithHistory.size(), 1); PaymentModelDao history1 = (PaymentModelDao) auditLogsWithHistory.get(0).getEntity(); Assert.assertEquals(auditLogsWithHistory.get(0).getChangeType(), ChangeType.INSERT); Assert.assertEquals(history1.getAccountRecordId(), savedPayment.getAccountRecordId()); Assert.assertEquals(auditLogsWithHistory.size(), 2); history1 = (PaymentModelDao) auditLogsWithHistory.get(0).getEntity(); PaymentModelDao history2 = (PaymentModelDao) auditLogsWithHistory.get(1).getEntity(); Assert.assertEquals(auditLogsWithHistory.get(0).getChangeType(), ChangeType.INSERT); Assert.assertEquals(history1.getAccountRecordId(), savedPayment.getAccountRecordId()); Assert.assertEquals(auditLogsWithHistory.size(), 3); history1 = (PaymentModelDao) auditLogsWithHistory.get(0).getEntity(); history2 = (PaymentModelDao) auditLogsWithHistory.get(1).getEntity(); final PaymentModelDao history3 = (PaymentModelDao) auditLogsWithHistory.get(2).getEntity(); Assert.assertEquals(auditLogsWithHistory.get(0).getChangeType(), ChangeType.INSERT); Assert.assertEquals(history1.getAccountRecordId(), savedPayment.getAccountRecordId()); Assert.assertEquals(history2.getTenantRecordId(), savedPayment.getTenantRecordId()); Assert.assertEquals(history2.getExternalKey(), savedPayment.getExternalKey()); Assert.assertTrue(auditLogsWithHistory.get(1).getEntity().getUpdatedDate().compareTo(auditLogsWithHistory.get(0).getEntity().getUpdatedDate()) >= 0); Assert.assertEquals(auditLogsWithHistory.get(2).getChangeType(), ChangeType.UPDATE); Assert.assertEquals(history3.getAccountRecordId(), savedPayment.getAccountRecordId());