use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderTest method testNamedOrderForCustomer.
@Test(groups = { "testNamedOrderForCustomer" }, dependsOnGroups = { "testOrderProperties" })
public void testNamedOrderForCustomer() throws PricingException {
Customer customer = customerService.createCustomerFromId(null);
customer = customerService.saveCustomer(customer);
Order order = orderService.createNamedOrderForCustomer("Birthday Order", customer);
Long orderId = order.getId();
assert order != null;
assert order.getName().equals("Birthday Order");
assert order.getCustomer().equals(customer);
orderService.cancelOrder(order);
assert orderService.findOrderById(orderId) == null;
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderTest method testOrderProperties.
@Test(groups = { "testOrderProperties" }, dependsOnGroups = { "testReadOrdersForCustomer" })
public void testOrderProperties() throws PricingException {
Customer customer = customerService.createCustomerFromId(null);
Order order = orderService.createNewCartForCustomer(customer);
assert order.getSubTotal() == null;
assert order.getTotal() == null;
Calendar testCalendar = Calendar.getInstance();
order.setSubmitDate(testCalendar.getTime());
assert order.getSubmitDate().equals(testCalendar.getTime());
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class CommonSetupBaseTest method createCustomerWithAddress.
/**
* Creates a country, state, and customer with the supplied customerAddress
* @param customerAddress
* @return customer created
*/
public CustomerAddress createCustomerWithAddress(CustomerAddress customerAddress) {
createCountry();
createState();
Customer customer = createCustomer();
customer.setUsername(String.valueOf(customer.getId()));
customerAddress.setCustomer(customer);
return saveCustomerAddress(customerAddress);
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class CustomerAddressTest method createCustomerAddress.
/**
* This method only exists because so many other tests depend on it, but should be removed once tests are more isolated
* @param customerAddress
*/
@Deprecated
@Test(groups = "createCustomerAddress", dataProvider = "setupCustomerAddress", dataProviderClass = CustomerAddressDataProvider.class, dependsOnGroups = { "readCustomer", "createCountry", "createState" })
@Transactional
@Rollback(false)
public void createCustomerAddress(CustomerAddress customerAddress) {
userName = "customer1";
Customer customer = customerService.readCustomerByUsername(userName);
assert customerAddress.getId() == null;
customerAddress.setCustomer(customer);
State state = stateService.findStateByAbbreviation("KY");
customerAddress.getAddress().setState(state);
Country country = countryService.findCountryByAbbreviation("US");
customerAddress.getAddress().setCountry(country);
customerAddress.getAddress().setIsoCountrySubdivision("US-KY");
ISOCountry isoCountry = isoService.findISOCountryByAlpha2Code("US");
customerAddress.getAddress().setIsoCountryAlpha2(isoCountry);
customerAddress = customerAddressService.saveCustomerAddress(customerAddress);
assert customer.equals(customerAddress.getCustomer());
userId = customerAddress.getCustomer().getId();
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class CustomerPhoneTest method createCustomerPhone.
@Test(groups = "createCustomerPhone", dataProvider = "setupCustomerPhone", dataProviderClass = CustomerPhoneDataProvider.class, dependsOnGroups = "readCustomer")
@Transactional
@Rollback(false)
public void createCustomerPhone(CustomerPhone customerPhone) {
userName = "customer1";
Customer customer = customerService.readCustomerByUsername(userName);
assert customerPhone.getId() == null;
customerPhone.setCustomer(customer);
Phone phone = new PhoneImpl();
phone.setPhoneNumber("214-214-2134");
customerPhone.setPhone(phone);
customerPhone = customerPhoneService.saveCustomerPhone(customerPhone);
assert customer.equals(customerPhone.getCustomer());
userId = customerPhone.getCustomer().getId();
}
Aggregations