コード例 #1
0
ファイル: MaterialServiceTest.java プロジェクト: alosix/gocd
  @Test
  public void shouldDelegateToMaterialRepository_getTotalModificationsFor() {
    GitMaterialConfig materialConfig = new GitMaterialConfig("http://test.com");
    GitMaterialInstance gitMaterialInstance =
        new GitMaterialInstance("http://test.com", null, null, "flyweight");

    when(materialRepository.findMaterialInstance(materialConfig)).thenReturn(gitMaterialInstance);

    when(materialRepository.getTotalModificationsFor(gitMaterialInstance)).thenReturn(1L);

    Long totalCount = materialService.getTotalModificationsFor(materialConfig);

    assertThat(totalCount, is(1L));
  }
コード例 #2
0
ファイル: MaterialServiceTest.java プロジェクト: alosix/gocd
  @Test
  public void shouldDelegateToMaterialRepository_getModificationsFor() {
    GitMaterialConfig materialConfig = new GitMaterialConfig("http://test.com");
    GitMaterialInstance gitMaterialInstance =
        new GitMaterialInstance("http://test.com", null, null, "flyweight");
    Pagination pagination = Pagination.pageStartingAt(0, 10, 10);
    Modifications modifications = new Modifications();
    modifications.add(new Modification("user", "comment", "email", new Date(), "revision"));

    when(materialRepository.findMaterialInstance(materialConfig)).thenReturn(gitMaterialInstance);

    when(materialRepository.getModificationsFor(gitMaterialInstance, pagination))
        .thenReturn(modifications);

    Modifications gotModifications =
        materialService.getModificationsFor(materialConfig, pagination);

    assertThat(gotModifications, is(modifications));
  }