Beispiel #1
0
  @Test
  public void getters() {
    // ID
    assertEquals(REPO, modelUpdated.getRepoId());
    assertEquals(modelUpdated.getRepoId(), modelUpdated.getRepoId());

    // Signature
    assertEquals(true, modelEmptySig.getUpdateSignature().isEmpty());
    assertEquals(modelEmptySig.getUpdateSignature(), UpdateSignature.EMPTY);
    assertEquals(modelEmptySig.getUpdateSignature(), modelEmptySig2.getUpdateSignature());

    // Resources
    // Issues
    ArrayList<Integer> issueIds = new ArrayList<>();
    for (int i = 1; i <= DummyRepoState.NO_OF_DUMMY_ISSUES; i++) {
      issueIds.add(i);
    }
    Collections.sort(issueIds); // 1, 2..10
    int issueCount = 1;
    for (TurboIssue issue : modelUpdated.getIssues()) {
      assertEquals(issueCount, modelUpdated.getIssueById(issueCount).get().getId());
      assertEquals(issueIds.get(issueCount - 1).intValue(), issue.getId());
      issueCount++;
    }

    // Labels
    ArrayList<String> labelNames = new ArrayList<>();
    for (int i = 1; i <= DummyRepoState.NO_OF_DUMMY_ISSUES; i++) {
      labelNames.add("Label " + i);
    }
    Collections.sort(labelNames); // Label 1, Label 10..12, Label 2..9
    int labelCount = 1;
    for (TurboLabel label : modelUpdated.getLabels()) {
      if (label.getFullName().startsWith("Label")) {
        assertEquals(labelNames.get(labelCount - 1), label.getFullName());
        assertEquals(
            "Label " + labelCount,
            modelUpdated.getLabelByActualName("Label " + labelCount).get().getFullName());
        labelCount++;
      }
    }

    // Milestones
    ArrayList<Integer> milestoneIds = new ArrayList<>();
    for (int i = 1; i <= DummyRepoState.NO_OF_DUMMY_ISSUES; i++) {
      milestoneIds.add(i);
    }
    Collections.sort(milestoneIds); // 1, 2..10
    int milestoneCount = 1;
    for (TurboMilestone milestone : modelUpdated.getMilestones()) {
      assertEquals(milestoneCount, milestone.getId());
      assertEquals(
          milestoneIds.get(milestoneCount - 1).intValue(),
          modelUpdated.getMilestoneById(milestoneCount).get().getId());
      assertEquals(
          "Milestone " + milestoneCount,
          modelUpdated.getMilestoneByTitle("Milestone " + milestoneCount).get().getTitle());
      milestoneCount++;
    }

    // Users
    ArrayList<String> userLogins = new ArrayList<>();
    for (int i = 1; i <= DummyRepoState.NO_OF_DUMMY_ISSUES; i++) {
      userLogins.add("User " + i);
    }
    Collections.sort(userLogins); // User 1, User 10, User 2..9
    int userCount = 1;
    for (TurboUser user : modelUpdated.getUsers()) {
      assertEquals(userLogins.get(userCount - 1), user.getLoginName());
      assertEquals(
          "User " + userCount,
          modelUpdated.getUserByLogin("User " + userCount).get().getLoginName());
      userCount++;
    }
  }