コード例 #1
0
  @Test
  public void shouldReturnAverageOfPointsBySprints() throws Exception {

    // 1 - media de pontos por sprint

    when(sprintService.getAllSprints()).thenReturn(getSprints());

    List<Temp> temps = statisticallyService.get();

    verify(sprintService).getAllSprints();

    assertEquals(new Double(40), temps.get(0).getAverage());
    assertEquals(new Double(22.5), temps.get(1).getAverage());
    assertEquals(new Double(32.3), temps.get(2).getAverage());
    assertEquals(new Double(34), temps.get(3).getAverage());
    assertEquals(new Double(36.6), temps.get(4).getAverage());
  }
コード例 #2
0
  @Test
  public void shouldReturnTotalOfPointsInBacklogInSprint() throws Exception {

    // 2 - total de pontos no backlog no sprint // TODO em portugues o comentario ??

    when(sprintService.getAllSprints()).thenReturn(getSprints());
    when(storyService.getStories(StoryStatus.BACKLOG)).thenReturn(getStories());

    List<Temp> temps = statisticallyService.get();

    verify(sprintService).getAllSprints();
    verify(storyService).getStories(StoryStatus.BACKLOG);

    System.out.println(
        DateUtils.parseDate("05/07/2012", "dd/MM/yyyy")
            .compareTo(DateUtils.parseDate("04/07/2012", "dd/MM/yyyy")));

    assertEquals(new Integer(50), temps.get(0).getPointsInBacklog());
    assertEquals(new Integer(100), temps.get(1).getPointsInBacklog());
    assertEquals(new Integer(120), temps.get(2).getPointsInBacklog());
    assertEquals(new Integer(140), temps.get(3).getPointsInBacklog());
    assertEquals(new Integer(250), temps.get(4).getPointsInBacklog());
  }