/**
   * Tests <code>{@link CopilotProjectDAOImpl#getCopilotProjects(long)}</code> method.
   *
   * @throws CopilotDAOException if any error occurs
   */
  @Test
  public void testGetCopilotProjects2() throws CopilotDAOException {

    CopilotProfile copilotProfile = TestHelper.createCopilotProfile();
    CopilotProject copilotProject1 = TestHelper.createCopilotProject();
    CopilotProject copilotProject2 = TestHelper.createCopilotProject();

    hibernateTemplate.save(copilotProfile.getStatus());
    hibernateTemplate.save(copilotProfile);

    copilotProject1.setCopilotProfileId(copilotProfile.getId());
    hibernateTemplate.save(copilotProject1.getStatus());
    hibernateTemplate.save(copilotProject1.getCopilotType());
    hibernateTemplate.save(copilotProject1);

    copilotProject2.setCopilotProfileId(copilotProfile.getId());
    hibernateTemplate.save(copilotProject2.getStatus());
    hibernateTemplate.save(copilotProject2.getCopilotType());
    hibernateTemplate.save(copilotProject2);

    List<CopilotProject> result =
        instance.getCopilotProjects(copilotProject1.getCopilotProfileId());

    Assert.assertEquals("Two results were expected.", 2, result.size());
    assertCopilotProject(copilotProject1, result.get(0));
    assertCopilotProject(copilotProject2, result.get(1));
  }
  /**
   * Tests <code>{@link
   * CopilotProjectDAOImpl#create(com.topcoder.direct.services.copilot.model.IdentifiableEntity)}
   * </code> method.
   *
   * <p>{@link CopilotDAOException} is expected.
   *
   * @throws CopilotDAOException if any error occurs
   */
  @Test(expected = CopilotDAOException.class)
  public void testCreateFailure1() throws CopilotDAOException {

    CopilotProject copilotProject = TestHelper.createCopilotProject();
    copilotProject.setId(1);
    hibernateTemplate.save(copilotProject.getStatus());

    instance.create(copilotProject);
  }
  /**
   * Asserts that the passed {@link CopilotProject} instances are exactly the same.
   *
   * @param copilotProject project to compare
   * @param result project to compare
   */
  private void assertCopilotProject(CopilotProject copilotProject, CopilotProject result) {
    Assert.assertEquals("Invalid CopilotProject id", copilotProject.getId(), result.getId());
    Assert.assertEquals(
        "Invalid CopilotProject status", copilotProject.getStatus(), result.getStatus());

    Assert.assertEquals("Invalid CopilotProject name", copilotProject.getName(), result.getName());
    Assert.assertEquals(
        "Invalid CopilotProject completion date",
        copilotProject.getCompletionDate(),
        result.getCompletionDate());
    Assert.assertEquals(
        "Invalid CopilotProject copilot type",
        copilotProject.getCopilotType(),
        result.getCopilotType());
    Assert.assertEquals(
        "Invalid CopilotProject customer feedback",
        copilotProject.getCustomerFeedback(),
        result.getCustomerFeedback());
    Assert.assertEquals(
        "Invalid CopilotProject customer rating",
        copilotProject.getCustomerRating(),
        result.getCustomerRating());
    Assert.assertEquals(
        "Invalid CopilotProject pm feedback",
        copilotProject.getPmFeedback(),
        result.getPmFeedback());
    Assert.assertEquals(
        "Invalid CopilotProject pm rating", copilotProject.getPmRating(), result.getPmRating());
    Assert.assertEquals(
        "Invalid CopilotProject tcDirectProjectId",
        copilotProject.getTcDirectProjectId(),
        result.getTcDirectProjectId());

    Assert.assertEquals(
        "Invalid CopilotProject create user",
        copilotProject.getCreateUser(),
        result.getCreateUser());
    Assert.assertEquals(
        "Invalid CopilotProject modify user",
        copilotProject.getModifyUser(),
        result.getModifyUser());
  }
  /**
   * Tests <code>{@link
   * CopilotProjectDAOImpl#update(com.topcoder.direct.services.copilot.model.IdentifiableEntity)}
   * </code> method.
   *
   * <p>{@link CopilotDAOException} is expected.
   *
   * @throws CopilotDAOException if any error occurs
   */
  @Test(expected = CopilotDAOException.class)
  public void testUpdateFailure1() throws CopilotDAOException {

    CopilotProject copilotProject = TestHelper.createCopilotProject();

    Session session = instance.getSession();
    session.save(copilotProject.getStatus());
    session.save(copilotProject);
    session.delete(copilotProject);

    instance.update(copilotProject);
  }