use of org.killbill.billing.overdue.caching.MockOverdueConfigCache in project killbill by killbill.
the class TestOverdueWrapper method testWrapperBasic.
@Test(groups = "slow")
public void testWrapperBasic() throws Exception {
final InputStream is = new ByteArrayInputStream(testOverdueHelper.getConfigXml().getBytes());
final DefaultOverdueConfig config = XMLLoader.getObjectFromStreamNoValidation(is, DefaultOverdueConfig.class);
((MockOverdueConfigCache) overdueConfigCache).loadOverwriteDefaultOverdueConfig(config);
Account account;
OverdueWrapper wrapper;
OverdueState state;
state = config.getOverdueStatesAccount().findState("OD1");
account = testOverdueHelper.createAccount(clock.getUTCToday().minusDays(31));
wrapper = overdueWrapperFactory.createOverdueWrapperFor(account, internalCallContext);
wrapper.refresh(clock.getUTCNow(), internalCallContext);
testOverdueHelper.checkStateApplied(state);
state = config.getOverdueStatesAccount().findState("OD2");
account = testOverdueHelper.createAccount(clock.getUTCToday().minusDays(41));
wrapper = overdueWrapperFactory.createOverdueWrapperFor(account, internalCallContext);
wrapper.refresh(clock.getUTCNow(), internalCallContext);
testOverdueHelper.checkStateApplied(state);
state = config.getOverdueStatesAccount().findState("OD3");
account = testOverdueHelper.createAccount(clock.getUTCToday().minusDays(51));
wrapper = overdueWrapperFactory.createOverdueWrapperFor(account, internalCallContext);
wrapper.refresh(clock.getUTCNow(), internalCallContext);
testOverdueHelper.checkStateApplied(state);
}
Aggregations