@Test(expected = ObjectNotFoundException.class)
  public void testDelete_noSuchIteration() {
    projectAction.setProjectId(-1);
    projectBusiness.delete(-1);
    expect(projectBusiness.retrieve(-1)).andThrow(new ObjectNotFoundException());
    replayAll();
    projectAction.setConfirmationString("yes");
    projectAction.delete();

    verifyAll();
  }
  @Test
  public void testProjectMetrics() {
    ProjectMetrics metrics = new ProjectMetrics();
    projectAction.setProjectId(project.getId());
    expect(projectBusiness.retrieve(project.getId())).andReturn(project);
    expect(projectBusiness.getProjectMetrics(project)).andReturn(metrics);
    replayAll();

    assertEquals(Action.SUCCESS, projectAction.projectMetrics());
    assertEquals(metrics, projectAction.getProjectMetrics());

    verifyAll();
  }
  @Test
  public void testDelete_success() {
    Project proj = new Project();
    Product parent = new Product();
    parent.setId(123);
    proj.setParent(parent);

    expect(projectBusiness.retrieve(1)).andReturn(proj);
    projectBusiness.delete(1);
    replayAll();
    projectAction.setConfirmationString("yes");
    assertEquals(Action.SUCCESS, projectAction.delete());
    assertEquals(123, projectAction.getProductId());
    verifyAll();
  }
  @Test(expected = ConstraintViolationException.class)
  public void testDelete_forbidden() {
    Project proj = new Project();
    Product prod = new Product();
    prod.setId(123);
    proj.setParent(prod);
    expect(projectBusiness.retrieve(1)).andReturn(proj);
    projectBusiness.delete(1);
    expectLastCall().andThrow(new ConstraintViolationException(null, null, null));
    expect(projectBusiness.retrieve(1)).andReturn(new Project());
    replayAll();
    projectAction.setConfirmationString("yes");
    projectAction.delete();

    verifyAll();
  }
 @Test(expected = ObjectNotFoundException.class)
 public void testProjectData_notFound() {
   projectAction.setProjectId(-1);
   expect(projectBusiness.getProjectData(-1)).andThrow(new ObjectNotFoundException());
   replayAll();
   projectAction.projectData();
   verifyAll();
 }
 @Test
 public void testInitializePrefetchData() {
   expect(projectBusiness.retrieve(123)).andReturn(project);
   replayAll();
   projectAction.initializePrefetchedData(123);
   assertEquals(project, projectAction.getProject());
   verifyAll();
 }
 @Test
 public void testRetrieve() {
   projectAction.setProjectId(1);
   expect(projectBusiness.retrieve(1)).andReturn(project);
   replayAll();
   projectAction.retrieve();
   assertEquals(project, projectAction.getProject());
   verifyAll();
 }
 @Test
 public void testProjectData() {
   ProjectTO projTO = new ProjectTO(project);
   projectAction.setProjectId(project.getId());
   expect(projectBusiness.getProjectData(project.getId())).andReturn(projTO);
   replayAll();
   assertEquals(Action.SUCCESS, projectAction.projectData());
   assertEquals(projTO, projectAction.getProject());
   verifyAll();
 }
 @Test
 public void testStore() {
   ProjectTO dummy = new ProjectTO(new Project());
   projectAction.setProductId(313);
   projectAction.setProjectId(1);
   projectAction.setProject(project);
   expect(projectBusiness.store(1, 313, project, null)).andReturn(dummy);
   replayAll();
   projectAction.store();
   assertEquals(dummy, projectAction.getProject());
   verifyAll();
 }