@Override public Plan findPlan(final String productName, final BillingPeriod term, final String priceListName, final DateTime requestedDate, final DateTime subscriptionStartDate) throws CatalogApiException { return findPlan(new PlanRequestWrapper(productName, term, priceListName), requestedDate, subscriptionStartDate); }
@Override public PlanPhase findPhase(final String phaseName, final DateTime requestedDate, final DateTime subscriptionStartDate) throws CatalogApiException { final String planName = DefaultPlanPhase.planName(phaseName); final Plan plan = findPlan(planName, requestedDate, subscriptionStartDate); return plan.findPhase(phaseName); }
@Test(groups = "fast") public void testErrorOnDateTooEarly() { final DateTime dt0 = new DateTime("1977-01-01T00:00:00+00:00"); try { vc.findPlan("foo", dt0); Assert.fail("Date is too early an exception should have been thrown"); } catch (CatalogApiException e) { Assert.assertEquals(e.getCode(), ErrorCode.CAT_NO_CATALOG_FOR_GIVEN_DATE.getCode()); } } }
vc.findPlan("pistol-monthly", dt0, dt0); Assert.fail("Exception should have been thrown there are no plans for this date"); } catch (CatalogApiException e) { final Plan newSubPlan1 = vc.findPlan("pistol-monthly", dt1, dt1); final Plan newSubPlan2 = vc.findPlan("pistol-monthly", dt2, dt2); final Plan newSubPlan214 = vc.findPlan("pistol-monthly", dt214, dt214); final Plan newSubPlan3 = vc.findPlan("pistol-monthly", dt3, dt3); final Plan exSubPlan2 = vc.findPlan("pistol-monthly", dt2, dt1); final Plan exSubPlan214 = vc.findPlan("pistol-monthly", dt214, dt1); final Plan exSubPlan3 = vc.findPlan("pistol-monthly", dt3, dt1);