in component-test/src/main/java/org/apache/fineract/cn/accounting/util/JournalEntryGenerator.java [52:80]
public static JournalEntry createRandomJournalEntry(final String debtorAccount,
final String debtorAmount,
final String creditorAccount,
final String creditorAmount) {
final JournalEntry journalEntry = new JournalEntry();
journalEntry.setTransactionIdentifier(RandomStringUtils.randomAlphanumeric(8));
journalEntry.setTransactionDate(ZonedDateTime.now(Clock.systemUTC()).format(DateTimeFormatter.ISO_ZONED_DATE_TIME));
journalEntry.setTransactionType(RandomStringUtils.randomAlphabetic(4));
journalEntry.setClerk("clark");
if (debtorAccount != null) {
final Debtor debtor = new Debtor();
debtor.setAccountNumber(debtorAccount);
debtor.setAmount(debtorAmount);
journalEntry.setDebtors(new HashSet<>(Collections.singletonList(debtor)));
} else {
journalEntry.setDebtors(Sets.newHashSet());
}
if (creditorAccount != null) {
final Creditor creditor = new Creditor();
creditor.setAccountNumber(creditorAccount);
creditor.setAmount(creditorAmount);
journalEntry.setCreditors(new HashSet<>(Collections.singletonList(creditor)));
} else {
journalEntry.setCreditors(Sets.newHashSet());
}
journalEntry.setNote(RandomStringUtils.randomAlphanumeric(512));
journalEntry.setMessage(RandomStringUtils.randomAlphanumeric(512));
return journalEntry;
}