CreditLine l3 = new CreditLine();
l3.setMaxCreditValue(BigDecimal.TEN);
l3.setDebtor(c);
l3.setCreditor(d);
CreditPath path = new CreditPath();
Collection<CreditLine> creditLines = path.getPath();
creditLines.add(l1);
creditLines.add(l2);
creditLines.add(l3);
CreditPaths paths = new CreditPaths();
paths.setPaths(Collections.singletonList(path));
try {
paths = creditLineWriter.roteDebt(paths, BigDecimal.ONE);
path = paths.getPaths().iterator().next();
for(CreditLine nextLine: path.getPath()) {
Assert.assertTrue(BigDecimal.ONE.equals(nextLine.getCurrentCredit()));
}
Assert.assertTrue(new BigDecimal(9).equals(
creditLineReader.getAvailableAmount(path.getPath().iterator().next())));
} catch (DebtRotingException e) {
Assert.fail();
}
creditLineWriter.roteDebt(paths, BigDecimal.TEN);