Exemplo n.º 1
0
 @Test(expected = ObjectNotFoundException.class)
 public void testProjectData_notFound() {
   projectAction.setProjectId(-1);
   expect(projectBusiness.getProjectData(-1)).andThrow(new ObjectNotFoundException());
   replayAll();
   projectAction.projectData();
   verifyAll();
 }
Exemplo n.º 2
0
  @Before
  public void setUp_dependencies() {

    projectAction = new ProjectAction();
    projectAction.setProjectId(1);
    projectBusiness = createMock(ProjectBusiness.class);
    projectAction.setProjectBusiness(projectBusiness);
  }
Exemplo n.º 3
0
 @Test
 public void testRetrieve() {
   projectAction.setProjectId(1);
   expect(projectBusiness.retrieve(1)).andReturn(project);
   replayAll();
   projectAction.retrieve();
   assertEquals(project, projectAction.getProject());
   verifyAll();
 }
Exemplo n.º 4
0
 @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();
 }
Exemplo n.º 5
0
  @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();
  }
Exemplo n.º 6
0
 @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();
 }
Exemplo n.º 7
0
  @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();
  }