コード例 #1
0
ファイル: CustomerTest.java プロジェクト: DavidG7/FreshTech
  /** Tests the functionality of the set methods for the customer class */
  @Test
  public void CustomerSetMethods() {

    testCustomer.setCustomerID(10);
    assertEquals(10, testCustomer.getCustomerID());

    testCustomer.setCustomerPhone("07788254414");
    assertEquals("07788254414", testCustomer.getCustomerPhone());

    testCustomer.setAvailableCredit(5000);
    assertEquals(5000f, testCustomer.getAvailableCredit(), 0.001f);

    testCustomer.setCustomerName("Jerry Springer");
    assertEquals("Jerry Springer", testCustomer.getCustomerName());

    testCustomer.setCustomerEmail("*****@*****.**");
    assertEquals("*****@*****.**", testCustomer.getCustomerEmail());

    testCustomer.setCustomerUsername("spring");
    assertEquals("spring", testCustomer.getCustomerUsername());

    testCustomer.setCustomerPassword("springer123");
    assertEquals("springer123", testCustomer.getCustomerPassword());

    testCustomer.setCustomerContactMethod("PHONE");
    assertEquals("PHONE", testCustomer.getCustomerContactMethod());
  }
コード例 #2
0
ファイル: DataGenerator.java プロジェクト: mdfaller/db
  /**
   * Get a customer to put in the database
   *
   * @param id for the customer
   * @param warehouse for the customer
   * @param station for the customer
   * @return customer
   */
  public Customer getCustomer(int id, Warehouse warehouse, Station station) {
    Customer customer = new Customer();

    customer.setCustomerID(id);
    customer.setWarehouseID(warehouse.getWarehouseID());
    customer.setStationID(station.getStationID());
    customer.setFirstName(fnames.get(randInt(0, fnames.size())));
    customer.setMiddleInitial(letters[randInt(0, letters.length)]);
    customer.setLastName(lnames.get(randInt(0, lnames.size())));
    customer.setAddress(randAddress());
    customer.setCity(cities.get(randInt(0, cities.size())));
    customer.setState(states.get(randInt(0, states.size())));
    customer.setZip(zips.get(randInt(0, zips.size())));
    customer.setPhone(randInt(100, 1000) + "-" + randInt(100, 1000) + "-" + randInt(1000, 10000));
    customer.setDateAdded(randDate());
    customer.setDiscount(new BigDecimal(randDouble(minDiscount, maxDiscount)));
    customer.setBalance(new BigDecimal(0));
    customer.setTotalPaid(new BigDecimal(0));
    customer.setNumPayments(0);
    customer.setDeliveriesReceived(0);

    return customer;
  }