Package org.company.recordshop.domain

Examples of org.company.recordshop.domain.Customer


    }
   
    @Test
    public void testFindByExampleWithStringDate() {
       
        customerDao.add(new Customer("Rembrandt", "van Rijn", new DateTime("1606-07-15"), 3));
        flush();
        clear();

        CustomerExample example = new CustomerExample();
        example.setBirthDate(new DateTime("1606-07-15"));
View Full Code Here


    }

    @Test
    public void testFindByExampleWithDate() {
       
        customerDao.add(new Customer("Rembrandt", "van Rijn", new DateTime(1606, 07, 15, 0, 0, 0, 0), 3));
        flush();
        clear();

        CustomerExample example = new CustomerExample();
        example.setBirthDate(new DateTime("1606-07-15"));
View Full Code Here

    Assert.notNull(source, "argument [source] may not be null");
    Assert.isNull(source.getId(),
        "Can not translate a dto with existing id to a new domain object. Dto: "
            + source);
    Customer target = new Customer(source.getFirstName(), source
        .getLastName(), source.getBirthDate(), source.getCustomerNr()

    );
    return fromDto(source, target, translated);
View Full Code Here

    @Autowired
    private CustomerDao customerDao;

    @Before
    public void setUp() {
        customerDao.add(new Customer("Rembrandt", "van Rijn", new DateTime(2010, 11, 6, 0, 0, 0, 0), 1));
        customerDao.add(new Customer("Saskia", "van Rijn", new DateTime(2011, 11, 6, 0, 0, 0, 0), 2));
        customerDao.add(new Customer("Paulus", "Potter", new DateTime(2012, 11, 6, 0, 0, 0, 0), 3));
        customerDao.add(new Customer("Tim", "Potter", new DateTime(2013, 11, 6, 0, 0, 0, 0), 4));
        flush();
        clear();
    }
View Full Code Here

     * {@link org.company.recordshop.business.CustomerServiceModelDomainServiceImpl#findCustomersByExample(org.company.recordshop.domain.CustomerExample)}
     * .
     */
    @Test
    public void testFindCustomersByExample() {
        service.createCustomer(new Customer("Johan", "Vogelzang", date(), 1));
        service.createCustomer(new Customer("Jos", "Warmer", date(), 2));
        service.createCustomer(new Customer("Eric Jan", "Malotaux", date(), 3));
        sessionFactory.getCurrentSession().flush();
        sessionFactory.getCurrentSession().clear();
        assertEquals(3, countRowsInTable("Customer_TABLE"));

        CustomerExample example = new CustomerExample();
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void validate(Object target, Errors errors) {

        Customer cust = (Customer) target;
        if (cust.getNumberOfEars() == 1 && cust.getDiscountPercentage() != 50) {
            errors.rejectValue("discountPercentage", "businessrule.OneEarDiscount.not.valid", new Integer[] { new Integer(50), new Integer(cust.getDiscountPercentage()) },
                    "discountPercentage" + " for Customers with one ear should be " + 50 + ", but was " + cust.getDiscountPercentage());
        }

    }
View Full Code Here

  @Test(expected = ConcurrentUpdateException.class)
  public void nullTarget() {
    // 'random' DTO translator
    FullCustomerDtoTranslator fullCustomerDtoTranslator = new FullCustomerDtoTranslator();

    Customer target = new Customer("a", "b", new DateTime(), 0);
    FullCustomerDto source = new FullCustomerDto(null, 1);
    source.setCustomerNr(1);
    source.setFirstName("Vincent");
    source.setLastName("van Gogh");
    source.setBirthDate(new DateTime("1953-03-30"));
View Full Code Here

  @Test(expected = ConcurrentUpdateException.class)
  public void tooHighVersion() throws Exception {
    // 'random' DTO translator
    FullCustomerDtoTranslator fullCustomerDtoTranslator = new FullCustomerDtoTranslator();

    Customer target = new Customer("a", "b", new DateTime(), 0);
    setField(target, "version", 0);
    FullCustomerDto source = new FullCustomerDto(null, 1);
    source.setCustomerNr(1);
    source.setFirstName("Vincent");
    source.setLastName("van Gogh");
View Full Code Here

  @Test(expected = ConcurrentUpdateException.class)
  public void testNullSource() throws Exception {
    // 'random' DTO translator
    FullCustomerDtoTranslator fullCustomerDtoTranslator = new FullCustomerDtoTranslator();

    Customer target = new Customer("a", "b", new DateTime(), 1);
    setField(target, "id", 0L);
    setField(target, "version", 0);
    FullCustomerDto source = new FullCustomerDto(0L, null);
    source.setCustomerNr(1);
    source.setFirstName("Vincent");
View Full Code Here

  @Test
  public void equals() throws Exception {
    // 'random' DTO translator
    FullCustomerDtoTranslator fullCustomerDtoTranslator = new FullCustomerDtoTranslator();

    Customer target = new Customer("a", "b", new DateTime(), 0);
    setField(target, "id", 0L);
    setField(target, "version", 2);
    FullCustomerDto source = new FullCustomerDto(0L, 2);
    // FIXME because the null checks are in the translator (should not be
    // there)
View Full Code Here

TOP

Related Classes of org.company.recordshop.domain.Customer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.