/** A simple test to check we can find an existing candidate. */
  @Test
  public void testFindById() {
    CandidateDaoJpa dao = new CandidateDaoJpa();
    dao.setEntityManager(this.em);

    Candidate found = dao.findById(1);

    assertNotNull("candidate should not be null", found);
    assertEquals("candidate should have id 1", found.getId(), new Integer(1));
  }
  /**
   * Test to check we can remove a candidate from the database.
   *
   * @throws DaoStoreException
   */
  @Test
  public void testRemove() throws DaoStoreException {
    CandidateDaoJpa dao = new CandidateDaoJpa();
    dao.setEntityManager(this.em);

    Collection<Candidate> found = dao.findAll();
    int initial = found.size();

    // remove the candidate
    Candidate candidate = dao.findById(new Integer(1));
    dao.remove(candidate);

    found = dao.findAll();
    int after = found.size();

    assertEquals("candidate size should have decreased", initial - 1, after);
  }