Пример #1
0
  /** Tests if all of a company's properties can be updated. */
  @Test
  public void updateTest() throws CompanyServiceValidationException {
    final String NEWADDRESS = "newaddress";
    final String NEWCOUNTRY = "newcountry";
    final String NEWCITY = "newcity";
    final String NEWNAME = "newname";
    final String NEWEMAIL = "newmail" + SUFFIX_EMAIL;
    final String NEWPHONE = "+361111111111";

    // persist a new company, then set new values
    Company company = persist();
    company.setAddress(NEWADDRESS);
    company.setCountry(NEWCOUNTRY);
    company.setCity(NEWCITY);
    company.setName(NEWNAME);
    company.setEmail(NEWEMAIL);
    company.setPhone(NEWPHONE);

    // merge the company with new values
    Company updated = companyService.save(company);

    // asserts
    assertTrue(updated.getAddress().equals(company.getAddress()));
    assertTrue(updated.getCity().equals(company.getCity()));
    assertTrue(updated.getCompanyId().equals(company.getCompanyId()));
    assertTrue(updated.getCountry().equals(company.getCountry()));
    assertTrue(updated.getName().equals(company.getName()));
    assertTrue(updated.getEmail().equals(company.getEmail()));
    assertTrue(updated.getPhone().equals(company.getPhone()));
  }
Пример #2
0
  /** Test if a companies' properties gets saved. */
  @Test
  public void detailsTest() {
    // persist and get details
    Company persisted = persist(construct());
    Company company = companyService.details(persisted.getId());

    // asserts
    assertTrue(persisted.getAddress().equals(company.getAddress()));
    assertTrue(persisted.getCity().equals(company.getCity()));
    assertTrue(persisted.getCompanyId().equals(company.getCompanyId()));
    assertTrue(persisted.getCountry().equals(company.getCountry()));
    assertTrue(persisted.getName().equals(company.getName()));
    assertTrue(persisted.getEmail().equals(company.getEmail()));
    assertTrue(persisted.getPhone().equals(company.getPhone()));
  }