public static Product[] createAll() { return new MockProduct[]{ createBicycle(), createPickup(), createSportsCar(), createJet(), createHorn(), createRedPaintJob() }; }
public static MockProduct createPickup() { return new MockProduct("Pickup", ProductCategory.BASE, "Vehcles"); }
@Override public PriceList getCurrentPriceList() { return new MockPriceList(); }
protected AccountData getAccountData(final int billingDay) { return new MockAccountBuilder().name(UUID.randomUUID().toString().substring(1, 8)) .firstNameLength(6) .email(UUID.randomUUID().toString().substring(1, 8)) .phone(UUID.randomUUID().toString().substring(1, 8)) .migrated(false) .isNotifiedForInvoices(false) .externalKey(UUID.randomUUID().toString().substring(1, 8)) .billingCycleDayLocal(billingDay) .currency(Currency.USD) .paymentMethodId(UUID.randomUUID()) .timeZone(DateTimeZone.UTC) .build(); }
final String postalCode, final String phone) { final Account result = new MockAccountBuilder(id) .externalKey(externalKey) .email(email) .name(name).firstNameLength(firstNameLength) .currency(currency) .billingCycleDayLocal(billCycleDayLocal) .paymentMethodId(paymentMethodId) .timeZone(timeZone) .locale(locale) .address1(address1) .address2(address2) .companyName(companyName) .city(city) .stateOrProvince(stateOrProvince) .country(country) .postalCode(postalCode) .phone(phone) .isNotifiedForInvoices(false) .build(); accounts.add(result); return result;
@Override public Account createAccount(final AccountData data, final CallContext context) throws AccountApiException { final Account result = new MockAccountBuilder(data).build(); accounts.add(result); return result; }
@Override @BeforeMethod(groups = "fast") public void beforeMethod() throws Exception { super.beforeMethod(); product = new MockProduct("platinium", "subscription", ProductCategory.BASE); plan = new MockPlan("platinum-monthly", product); phase = new MockPhase(PhaseType.EVERGREEN, plan, MockDuration.UNLIMITED(), 25.95); Mockito.when(catalog.findPlan(Mockito.anyString(), Mockito.<DateTime>any())).thenReturn(plan); Mockito.when(catalog.findPlan(Mockito.anyString(), Mockito.<DateTime>any(), Mockito.<DateTime>any())).thenReturn(plan); Mockito.when(catalog.findPhase(Mockito.anyString(), Mockito.<DateTime>any(), Mockito.<DateTime>any())).thenReturn(phase); Mockito.when(catalogService.getFullCatalog()).thenReturn(catalog); subscription = new MockSubscription(SubscriptionState.ACTIVE, plan, phase); }
public MockPriceList() { this(false, UUID.randomUUID().toString(), new MockPlan()); }
@Test(groups = "fast") public void testEquals() throws Exception { Assert.assertSame(subscription, subscription); Assert.assertEquals(subscription, subscription); Assert.assertTrue(subscription.equals(subscription)); final Subscription otherSubscription = new MockSubscription(SubscriptionState.CANCELLED, plan, phase); Assert.assertTrue(!subscription.equals(new BusinessSubscription(otherSubscription, USD, catalog))); } }
public AccountData initAccountData() { final AccountData accountData = new MockAccountBuilder().name(UUID.randomUUID().toString()) .firstNameLength(6) .email(UUID.randomUUID().toString()) .phone(UUID.randomUUID().toString()) .migrated(false) .isNotifiedForInvoices(false) .externalKey(UUID.randomUUID().toString()) .billingCycleDayLocal(1) .currency(Currency.USD) .paymentMethodId(UUID.randomUUID()) .timeZone(DateTimeZone.forID("Europe/Paris")) .build(); assertNotNull(accountData); return accountData; }
public MockAccountBuilder(final AccountData data) { this.id = UUID.randomUUID(); this.address1(data.getAddress1()); this.address2(data.getAddress2()); this.billingCycleDayLocal(data.getBillCycleDayLocal()); this.city(data.getCity()); this.companyName(data.getCompanyName()); this.country(data.getCountry()); this.currency(data.getCurrency()); this.email(data.getEmail()); this.externalKey(data.getExternalKey()); this.firstNameLength(data.getFirstNameLength()); this.isNotifiedForInvoices(data.isNotifiedForInvoices()); this.locale(data.getLocale()); this.migrated(data.isMigrated()); this.name(data.getName()); this.paymentMethodId(data.getPaymentMethodId()); this.phone(data.getPhone()); this.postalCode(data.getPostalCode()); this.stateOrProvince(data.getStateOrProvince()); this.timeZone(data.getTimeZone()); }
private BillingEvent createEvent(final SubscriptionBase sub, final DateTime effectiveDate, final SubscriptionBaseTransitionType type, final long totalOrdering) { final int billCycleDay = 1; final Plan shotgun = new MockPlan(); final PlanPhase shotgunMonthly = createMockMonthlyPlanPhase(null, BigDecimal.ZERO, PhaseType.TRIAL); final Account account = new MockAccountBuilder().build(); return new DefaultBillingEvent(account, sub, effectiveDate, shotgun, shotgunMonthly, BigDecimal.ZERO, null, Currency.USD, BillingPeriod.NO_BILLING_PERIOD, billCycleDay, BillingModeType.IN_ADVANCE, "Test Event 1", totalOrdering, type, DateTimeZone.UTC); }
public static MockProduct createJet() { return new MockProduct("Jet", ProductCategory.BASE, "Vehcles"); }
public Account createAccount(final CallContext callContext) throws AccountApiException { final AccountData accountData = new MockAccountBuilder().name(UUID.randomUUID().toString().substring(1, 8)) .firstNameLength(6) .email(UUID.randomUUID().toString().substring(1, 8)) .phone(UUID.randomUUID().toString().substring(1, 8)) .migrated(false) .isNotifiedForInvoices(true) .externalKey(UUID.randomUUID().toString().substring(1, 8)) .billingCycleDayLocal(31) .currency(accountCurrency) .paymentMethodId(UUID.randomUUID()) .timeZone(DateTimeZone.UTC) .build(); return accountUserApi.createAccount(accountData, callContext); }
public static MockProduct createHorn() { return new MockProduct("Horn", ProductCategory.ADD_ON, "Vehcles"); }
public static MockProduct createRedPaintJob() { return new MockProduct("RedPaintJob", ProductCategory.ADD_ON, "Vehcles"); }
public static MockProduct createSpotlight() { return new MockProduct("spotlight", ProductCategory.ADD_ON, "Vehcles"); }
public static MockProduct createBicycle() { return new MockProduct("Bicycle", ProductCategory.BASE, "Vehcles"); }
public static MockProduct createSportsCar() { return new MockProduct("SportsCar", ProductCategory.BASE, "Vehcles"); }
public MockPlan() { this(UUID.randomUUID().toString(), new MockProduct()); }