コード例 #1
0
  @Before
  public void setUp() {
    savedCompany = new CompanyBuilder().withUsers(new UserBuilder().build()).build();

    savedCompany = companyDao.save(savedCompany);
    savedUser = savedCompany.getUsers().iterator().next();
  }
コード例 #2
0
  @Test
  public void testFindByDate() {

    Company company = new CompanyBuilder().build();

    Candidate candidate1 =
        new CandidateBuilder()
            .withName(new Name("Candidate1"))
            .withEmail("*****@*****.**")
            .withCompany(company)
            .build();
    Candidate candidate2 =
        new CandidateBuilder().withName(new Name("Candidate2")).withCompany(company).build();
    Candidate candidate3 =
        new CandidateBuilder().withName(new Name("Candidate3")).withCompany(company).build();

    companyDao.save(company);
    candidateDao.save(candidate1);
    candidateDao.save(candidate2);
    candidateDao.save(candidate3);

    GregorianCalendar start = new GregorianCalendar();
    start.add(Calendar.HOUR_OF_DAY, -24);
    GregorianCalendar end = new GregorianCalendar();

    List<Candidate> results = candidateDao.findByCompanyIDandDateRange(company.getId(), start, end);
    assertEquals(3, results.size());
  }