Package jvalidations.cookbook

Examples of jvalidations.cookbook.Section_ValidatingMultipleFields$Customer$ValidationReport


    private ConcurrentHashMap<String, Customer> customers =
        new ConcurrentHashMap<String, Customer>();

    public List<Customer> getCustomersByName(String name) throws NoSuchCustomerException {
        Customer customer = getCustomerByName(name);

        List<Customer> customers = new ArrayList<Customer>();
        customers.add(customer);

        return customers;
View Full Code Here


        customers.put(newCustomer.getName(), newCustomer);
        return newCustomer;
    }

    public Customer getCustomerByName(String name) throws NoSuchCustomerException {
        Customer customer = customers.get(name);
        if (customer == null) {
            NoSuchCustomer noSuchCustomer = new NoSuchCustomer();
            noSuchCustomer.setCustomerName(name);
            throw new NoSuchCustomerException("Did not find any matching customer for name=" + name,
                                              noSuchCustomer);
View Full Code Here

    private ConcurrentHashMap<String, Customer> customers =
        new ConcurrentHashMap<String, Customer>();

    public List<Customer> getCustomersByName(String name) throws NoSuchCustomerException {
        Customer customer = getCustomerByName(name);

        List<Customer> customers = new ArrayList<Customer>();
        customers.add(customer);

        return customers;
View Full Code Here

        return newCustomer;
    }

    public Customer getCustomerByName(String name) throws NoSuchCustomerException {

        Customer customer = customers.get(name);
        if (customer == null) {
            NoSuchCustomer noSuchCustomer = new NoSuchCustomer();
            noSuchCustomer.setCustomerName(name);
            throw new NoSuchCustomerException("Did not find any matching customer for name=" + name,
                                              noSuchCustomer);
View Full Code Here

  protected void tearDown() throws Exception {
    super.tearDown();
  }

  public void testCustomer() {
    Customer c = new Customer("David");
    assertNotNull(c)
  }
View Full Code Here

    Customer c = new Customer("David");
    assertNotNull(c)
  }

  public void testAddRental() {
    Customer customer2 = new Customer("Sallie");
    Movie movie1 = new Movie("Gone with the Wind", Movie.REGULAR);
    Rental rental1 = new Rental(movie1, 3); // 3 day rental
    customer2.addRental(rental1);
  }
View Full Code Here

    Rental rental1 = new Rental(movie1, 3); // 3 day rental
    customer2.addRental(rental1);
  }

  public void testGetName() {
    Customer c = new Customer("David");
    assertEquals("David", c.getName());
  }
View Full Code Here

    Customer c = new Customer("David");
    assertEquals("David", c.getName());
  }

  public void testStatementForRegularMovie() {
    Customer customer2 = new Customer("Sallie");
    Movie movie1 = new Movie("Gone with the Wind", Movie.REGULAR);
    Rental rental1 = new Rental(movie1, 3); // 3 day rental
    customer2.addRental(rental1);
    String expected = "Rental Record for Sallie\n" +
              "\tGone with the Wind\t3.5\n" +
              "Amount owed is 3.5\n" +
              "You earned 1 frequent renter points";
    String statement = customer2.statement();
    assertEquals(expected, statement);
  }
View Full Code Here

    String statement = customer2.statement();
    assertEquals(expected, statement);
  }
 
  public void testStatementForNewReleaseMovie() {
    Customer customer2 = new Customer("Sallie");
    Movie movie1 = new Movie("Star Wars", Movie.NEW_RELEASE);
    Rental rental1 = new Rental(movie1, 3); // 3 day rental
    customer2.addRental(rental1);
    String expected = "Rental Record for Sallie\n" +
              "\tStar Wars\t9.0\n" +
              "Amount owed is 9.0\n" +
              "You earned 2 frequent renter points";
    String statement = customer2.statement();
    assertEquals(expected, statement);
  }
View Full Code Here

    String statement = customer2.statement();
    assertEquals(expected, statement);
  }
 
  public void testStatementForChildrensMovie() {
    Customer customer2 = new Customer("Sallie");
    Movie movie1 = new Movie("Madagascar", Movie.CHILDRENS);
    Rental rental1 = new Rental(movie1, 3); // 3 day rental
    customer2.addRental(rental1);
    String expected = "Rental Record for Sallie\n" +
              "\tMadagascar\t1.5\n" +
              "Amount owed is 1.5\n" +
              "You earned 1 frequent renter points";
    String statement = customer2.statement();
    assertEquals(expected, statement);
  }
View Full Code Here

TOP

Related Classes of jvalidations.cookbook.Section_ValidatingMultipleFields$Customer$ValidationReport

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.