private void validateCompany(Company c, int id) {
   assertThat(c.getId(), is(id));
   assertThat(c.getName(), is("百度时代网络技术(北京)有限公司"));
   assertThat(c.getDepartmentList().size(), is(4));
   assertThat(c.getDepartmentList().get(0).getId(), is(101));
   assertThat(c.getDepartmentList().get(0).getName(), is("R&D"));
 }
  public void testAdd(CompanyService companyService) {
    Company c = CompanyBuilder.buildSimple();
    c.setId(555);
    Company ret = companyService.add(c);
    validateCompany(ret, 555);

    Company ret2 = companyService.get(555);
    validateCompany(ret2, 555);
  }
 public void testAddNegative(CompanyService companyService) {
   testAdd(companyService);
   Company c = CompanyBuilder.buildSimple();
   try {
     c.setId(555);
     companyService.add(c);
     companyService.add(c);
   } catch (IdDuplicateException e) {
     assertThat(e.getClass().getName(), is(IdDuplicateException.class.getName()));
     return;
   } catch (Throwable t) {
     assertThat(t.getCause().getMessage(), is("Company id duplicate"));
     return;
   }
   fail("should not get here");
 }