/** Tests if all of an owner's properties can be updated. */
  @Test
  public void updateOwnerTest() throws CompanyServiceValidationException {
    final String NEWFIRSTNAME = "newfirst";
    final String NEWLASTNAME = "newlast";
    final int NUM = 2;

    // persist a company with NUM owners
    Company company = persist(construct(1, NUM));

    // set new values
    for (int i = 0; i < company.getOwners().size(); i++) {
      Owner o = company.getOwners().get(i);
      o.setFirstName(NEWFIRSTNAME);
      o.setLastName(NEWLASTNAME);
    }

    // update the company (and owners)
    Company updated = companyService.save(company);
    assertEquals(company.getOwners().size(), updated.getOwners().size());

    // check
    for (int i = 0; i < updated.getOwners().size(); i++) {
      Owner uOwner = updated.getOwners().get(i);
      Owner cOwner = company.getOwners().get(i);

      assertTrue(uOwner.getFirstName().equals(cOwner.getFirstName()));
      assertTrue(uOwner.getLastName().equals(cOwner.getLastName()));
    }
  }
  /** Tests if owner's properties gets saved properly. */
  @Test
  public void ownerDetailsTest() {
    final int NUM = 3;
    // save a company with NUM owners
    Company persisted = persist(construct(1, NUM));
    Company found = companyService.details(persisted.getId());
    assertTrue(persisted.getOwners().size() == found.getOwners().size());

    // compare the previously returned and the found owners' properties
    for (int i = 0; i < NUM; i++) {
      Owner persistedOwner = persisted.getOwners().get(i);
      Owner foundOwner = found.getOwners().get(i);

      // asserts
      assertTrue(persistedOwner.getFirstName().equals(foundOwner.getFirstName()));
      assertTrue(persistedOwner.getLastName().equals(foundOwner.getLastName()));
    }
  }