use of org.killbill.billing.catalog.MockCatalog in project killbill by killbill.
the class TestDefaultSubscriptionTransferApi method beforeMethod.
@Override
@BeforeMethod(groups = "fast")
public void beforeMethod() throws Exception {
super.beforeMethod();
final NonEntityDao nonEntityDao = Mockito.mock(NonEntityDao.class);
final SubscriptionDao dao = Mockito.mock(SubscriptionDao.class);
final CatalogService catalogService = new MockCatalogService(new MockCatalog(), cacheControllerDispatcher);
final SubscriptionBaseApiService apiService = Mockito.mock(SubscriptionBaseApiService.class);
final SubscriptionBaseTimelineApi timelineApi = Mockito.mock(SubscriptionBaseTimelineApi.class);
transferApi = new DefaultSubscriptionBaseTransferApi(clock, dao, timelineApi, catalogService, apiService, internalCallContextFactory);
}
use of org.killbill.billing.catalog.MockCatalog in project killbill by killbill.
the class TestCasePhase method testOrder.
@Test(groups = "fast")
public void testOrder() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProduct(0);
final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
final DefaultCaseResult cr0 = new DefaultCaseResult(product, ProductCategory.BASE, BillingPeriod.MONTHLY, priceList, PhaseType.EVERGREEN, Result.FOO);
final DefaultCaseResult cr1 = new DefaultCaseResult(product, ProductCategory.BASE, BillingPeriod.MONTHLY, priceList, PhaseType.EVERGREEN, Result.BAR);
final DefaultCaseResult cr2 = new DefaultCaseResult(product, ProductCategory.BASE, BillingPeriod.MONTHLY, priceList, PhaseType.EVERGREEN, Result.TINKYWINKY);
final DefaultCaseResult cr3 = new DefaultCaseResult(product, ProductCategory.BASE, BillingPeriod.ANNUAL, priceList, PhaseType.EVERGREEN, Result.DIPSY);
final DefaultCaseResult cr4 = new DefaultCaseResult(product, ProductCategory.BASE, BillingPeriod.ANNUAL, priceList, PhaseType.EVERGREEN, Result.LALA);
final Result r1 = DefaultCasePhase.getResult(new DefaultCaseResult[] { cr0, cr1, cr2, cr3, cr4 }, new PlanPhaseSpecifier(product.getName(), BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN), cat);
Assert.assertEquals(Result.FOO, r1);
final Result r2 = DefaultCasePhase.getResult(new DefaultCaseResult[] { cr0, cr1, cr2, cr3, cr4 }, new PlanPhaseSpecifier(product.getName(), BillingPeriod.ANNUAL, priceList.getName(), PhaseType.EVERGREEN), cat);
Assert.assertEquals(Result.DIPSY, r2);
}
use of org.killbill.billing.catalog.MockCatalog in project killbill by killbill.
the class TestPlanRules method beforeMethod.
@BeforeMethod(groups = "fast")
public void beforeMethod() {
cat = new MockCatalog();
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[0];
final DefaultCaseChangePlanPolicy casePolicy = new DefaultCaseChangePlanPolicy().setPolicy(BillingActionPolicy.END_OF_TERM);
final DefaultCaseChangePlanAlignment caseAlignment = new DefaultCaseChangePlanAlignment().setAlignment(PlanAlignmentChange.START_OF_SUBSCRIPTION);
final DefaultCasePriceList casePriceList = new DefaultCasePriceList().setToPriceList(priceList2);
cat.getPlanRules().setChangeCase(new DefaultCaseChangePlanPolicy[] { casePolicy }).setChangeAlignmentCase(new DefaultCaseChangePlanAlignment[] { caseAlignment }).setPriceListCase(new DefaultCasePriceList[] { casePriceList });
}
use of org.killbill.billing.catalog.MockCatalog in project killbill by killbill.
the class TestCase method testWildCardProduct.
@Test(groups = "fast")
public void testWildCardProduct() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProduct(0);
final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
final DefaultCaseResult cr = new DefaultCaseResult(null, ProductCategory.BASE, BillingPeriod.MONTHLY, priceList, Result.FOO);
assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
assertion(Result.FOO, cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), cat);
assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", cat);
}
use of org.killbill.billing.catalog.MockCatalog in project killbill by killbill.
the class TestCase method testWildCardBillingPeriod.
@Test(groups = "fast")
public void testWildCardBillingPeriod() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProduct(0);
final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
final DefaultCaseResult cr = new DefaultCaseResult(product, ProductCategory.BASE, null, priceList, Result.FOO);
assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
assertionNull(cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), cat);
assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", cat);
}
Aggregations