Search in sources :

Example 1 with MockOverdueConfigCache

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);
}
Also used : Account(org.killbill.billing.account.api.Account) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) DefaultOverdueConfig(org.killbill.billing.overdue.config.DefaultOverdueConfig) MockOverdueConfigCache(org.killbill.billing.overdue.caching.MockOverdueConfigCache) OverdueState(org.killbill.billing.overdue.api.OverdueState) Test(org.testng.annotations.Test)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 Account (org.killbill.billing.account.api.Account)1 OverdueState (org.killbill.billing.overdue.api.OverdueState)1 MockOverdueConfigCache (org.killbill.billing.overdue.caching.MockOverdueConfigCache)1 DefaultOverdueConfig (org.killbill.billing.overdue.config.DefaultOverdueConfig)1 Test (org.testng.annotations.Test)1