use of org.killbill.billing.catalog.MockCatalog in project killbill by killbill.
the class TestCaseChange method testOrder.
@Test(groups = "fast")
public void testOrder() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product1 = cat.getCurrentProduct(0);
final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
final DefaultProduct product2 = cat.getCurrentProduct(2);
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
final DefaultCaseChangeResult cr0 = new DefaultCaseChangeResult(product1, product2, ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1, priceList2, PhaseType.EVERGREEN, Result.FOO);
final DefaultCaseChangeResult cr1 = new DefaultCaseChangeResult(product1, product2, ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1, priceList2, PhaseType.EVERGREEN, Result.BAR);
final DefaultCaseChangeResult cr2 = new DefaultCaseChangeResult(product1, product2, ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1, priceList2, PhaseType.EVERGREEN, Result.TINKYWINKY);
final DefaultCaseChangeResult cr3 = new DefaultCaseChangeResult(product1, product2, ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.ANNUAL, priceList1, priceList2, PhaseType.EVERGREEN, Result.DIPSY);
final DefaultCaseChangeResult cr4 = new DefaultCaseChangeResult(product1, product2, ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.ANNUAL, priceList1, priceList2, PhaseType.EVERGREEN, Result.LALA);
final Result r1 = DefaultCaseChange.getResult(new DefaultCaseChangeResult[] { cr0, cr1, cr2, cr3, cr4 }, new PlanPhaseSpecifier(product1.getName(), BillingPeriod.MONTHLY, priceList1.getName(), PhaseType.EVERGREEN), new PlanSpecifier(product2.getName(), BillingPeriod.MONTHLY, priceList2.getName()), cat);
Assert.assertEquals(r1, Result.FOO);
final Result r2 = DefaultCaseChange.getResult(new DefaultCaseChangeResult[] { cr0, cr1, cr2, cr3, cr4 }, new PlanPhaseSpecifier(product1.getName(), BillingPeriod.MONTHLY, priceList1.getName(), PhaseType.EVERGREEN), new PlanSpecifier(product2.getName(), BillingPeriod.ANNUAL, priceList2.getName()), cat);
Assert.assertEquals(r2, Result.DIPSY);
}
use of org.killbill.billing.catalog.MockCatalog in project killbill by killbill.
the class TestCaseChange method testWildcardFromBillingPeriod.
@Test(groups = "fast")
public void testWildcardFromBillingPeriod() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product1 = cat.getCurrentProduct(0);
final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
final DefaultProduct product2 = cat.getCurrentProduct(2);
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(product1, product2, ProductCategory.BASE, ProductCategory.BASE, null, BillingPeriod.MONTHLY, priceList1, priceList2, PhaseType.EVERGREEN, Result.FOO);
assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, cat.getCurrentProduct(1).getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), cat.getCurrentProduct(1).getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.ANNUAL, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.ANNUAL, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, cat.getCurrentProduct(1).getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), cat.getCurrentProduct(1).getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.TRIAL, cat);
}
use of org.killbill.billing.catalog.MockCatalog in project killbill by killbill.
the class TestCaseChange method testWildcardFromProductCategory.
@Test(groups = "fast")
public void testWildcardFromProductCategory() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product1 = cat.getCurrentProduct(0);
final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
final DefaultProduct product2 = cat.getCurrentProduct(2);
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(product1, product2, null, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1, priceList2, PhaseType.EVERGREEN, Result.FOO);
assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, cat.getCurrentProduct(1).getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), cat.getCurrentProduct(1).getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.ANNUAL, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.ANNUAL, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, cat.getCurrentProduct(1).getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), cat.getCurrentProduct(1).getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.TRIAL, cat);
}
use of org.killbill.billing.catalog.MockCatalog in project killbill by killbill.
the class TestCaseChange method testWildcardFromProduct.
@Test(groups = "fast")
public void testWildcardFromProduct() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product1 = cat.getCurrentProduct(0);
final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
final DefaultProduct product2 = cat.getCurrentProduct(2);
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(null, product2, ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1, priceList2, PhaseType.EVERGREEN, Result.FOO);
assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertion(Result.FOO, cr, cat.getCurrentProduct(1).getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), cat.getCurrentProduct(1).getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.ANNUAL, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.ANNUAL, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, cat.getCurrentProduct(1).getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), cat.getCurrentProduct(1).getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.TRIAL, cat);
}
use of org.killbill.billing.catalog.MockCatalog in project killbill by killbill.
the class TestCaseChange method testWildcardToProduct.
@Test(groups = "fast")
public void testWildcardToProduct() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product1 = cat.getCurrentProduct(0);
final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
final DefaultProduct product2 = cat.getCurrentProduct(2);
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(product1, null, ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1, priceList2, PhaseType.EVERGREEN, Result.FOO);
assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, cat.getCurrentProduct(1).getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertion(Result.FOO, cr, product1.getName(), cat.getCurrentProduct(1).getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.ANNUAL, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.ANNUAL, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, cat.getCurrentProduct(1).getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), cat.getCurrentProduct(1).getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.TRIAL, cat);
}
Aggregations