public static Product[] createAll() { return new MockProduct[]{ createBicycle(), createPickup(), createSportsCar(), createJet(), createHorn(), createRedPaintJob() }; }
@Override public PriceList getCurrentPriceList() { return new MockPriceList(); }
public static MockProduct createPickup() { return new MockProduct("Pickup", ProductCategory.BASE, "Vehcles"); }
final String phone, final String notes) { 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) .notes(notes) .build(); accounts.add(result); return result;
public MockAccountBuilder(final AccountData data) { 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.parentAccountId(data.getParentAccountId()); this.isPaymentDelegatedToParent(data.isPaymentDelegatedToParent()); this.email(data.getEmail()); this.externalKey(data.getExternalKey()); this.firstNameLength(data.getFirstNameLength()); this.locale(data.getLocale()); this.migrated(data.isMigrated()); this.name(data.getName()); this.paymentMethodId(data.getPaymentMethodId()); this.phone(data.getPhone()); this.notes(data.getNotes()); this.postalCode(data.getPostalCode()); this.stateOrProvince(data.getStateOrProvince()); this.referenceTime(data.getReferenceTime()); this.timeZone(data.getTimeZone()); if (data instanceof Account) { this.id = ((Account) data).getId(); this.createdDate(((Account) data).getCreatedDate()); this.updatedDate(((Account) data).getUpdatedDate()); } else { this.id = UUID.randomUUID();
public AccountData initAccountData(final Clock clock) { final AccountData accountData = new MockAccountBuilder().name(UUIDs.randomUUID().toString().substring(1, 8)) .firstNameLength(6) .email(UUIDs.randomUUID().toString().substring(1, 8)) .phone(UUIDs.randomUUID().toString().substring(1, 8)) .migrated(false) .externalKey(UUIDs.randomUUID().toString()) .billingCycleDayLocal(1) .currency(Currency.USD) .paymentMethodId(UUIDs.randomUUID()) .referenceTime(clock.getUTCNow()) .timeZone(DateTimeZone.forID("Europe/Paris")) .build(); assertNotNull(accountData); return accountData; }
private void createAccountAndRefreshTimeAwareContext(final DateTimeZone dateTimeZone, final DateTime referenceDateTime) throws AccountApiException { final Account accountData = new MockAccountBuilder().externalKey(UUID.randomUUID().toString()) .timeZone(dateTimeZone) .createdDate(referenceDateTime) .build(); GuicyKillbillTestSuiteNoDB.createMockAccount(accountData, accountUserApi, accountInternalApi, immutableAccountInternalApi, nonEntityDao, clock, internalCallContextFactory, callContext, internalCallContext); } }
private void refreshCallContext(final DateTime effectiveDateTime, final DateTimeZone timeZone) { final Account account = new MockAccountBuilder().timeZone(timeZone) .createdDate(effectiveDateTime) .referenceTime(effectiveDateTime) .build(); internalCallContext.setFixedOffsetTimeZone(AccountDateTimeUtils.getFixedOffsetTimeZone(account)); internalCallContext.setReferenceTime(account.getReferenceTime()); } }
Assert.assertEquals(history1.getLocale(), createdAccount.getLocale()); final AccountData accountData = new MockAccountBuilder(new DefaultAccount(account)).migrated(false) .locale("FR-CA") .build(); final AccountModelDao updatedAccount = new AccountModelDao(account.getId(), accountData); accountDao.update(updatedAccount, true, internalCallContext); Assert.assertEquals(history2.getLocale(), retrievedAccount.getLocale()); final AccountData accountData2 = new MockAccountBuilder(new DefaultAccount(updatedAccount)).locale("en_US") .build(); final AccountModelDao updatedAccount2 = new AccountModelDao(account.getId(), accountData2); accountDao.update(updatedAccount2, true, internalCallContext);
@Override public Account createAccount(final AccountData data, final CallContext context) throws AccountApiException { final Account result = new MockAccountBuilder(data).build(); accounts.add(result); return result; }
public MockPriceList() { this(UUID.randomUUID().toString(), new MockPlan()); }
public static Product[] createAll() { return new MockProduct[]{ createBicycle(), createPickup(), createSportsCar(), createJet(), createHorn(), createRedPaintJob() }; }
public static MockProduct createHorn() { return new MockProduct("Horn", 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 static MockProduct createJet() { return new MockProduct("Jet", ProductCategory.BASE, "Vehcles"); }
public static MockProduct createSpotlight() { return new MockProduct("spotlight", ProductCategory.ADD_ON, "Vehcles"); }
public static MockProduct createRedPaintJob() { return new MockProduct("RedPaintJob", ProductCategory.ADD_ON, "Vehcles"); }
public MockPlan() { this(UUID.randomUUID().toString(), new MockProduct()); }
public static MockProduct createSportsCar() { return new MockProduct("SportsCar", ProductCategory.BASE, "Vehcles"); }