Пример #1
0
 /**
  * Tests that {@code editIssueState} returns Optional.empty() if the model for the issue given in
  * the argument can't be found
  */
 @Test
 public void editIssueState_issueNotFound() {
   Model model = new Model("testrepo");
   assertEquals(Optional.empty(), model.editIssueState(1, true));
   assertEquals(Optional.empty(), model.editIssueState(1, false));
 }
Пример #2
0
 /**
  * Tests that replaceIssueLabels returns Optional.empty() if the model for the issue given in the
  * argument can't be found
  */
 @Test
 public void replaceIssueLabels_issueNotFound() {
   Model model = new Model("testrepo");
   assertEquals(Optional.empty(), model.replaceIssueLabels(1, new ArrayList<>()));
 }
Пример #3
0
 /**
  * Tests that replaceIssueAssigneeOnServer returns Optional.empty() if the model for the issue
  * given in the argument can't be found
  */
 @Test
 public void replaceIssueAssignee_issueNotFound() {
   Model model = new Model("testrepo");
   assertEquals(Optional.empty(), model.replaceIssueAssignee(1, Optional.of("")));
 }
Пример #4
0
  @Test
  public void operations() {

    // Issues

    try {
      modelUpdated.getIssueById(0);
    } catch (AssertionError ignored) {
    }
    try {
      modelUpdated.getIssueById(-1);
    } catch (AssertionError ignored) {
    }

    assertEquals(
        Optional.<TurboIssue>empty(),
        modelUpdated.getIssueById(DummyRepoState.NO_OF_DUMMY_ISSUES + 1));
    assertEquals("Issue 10", modelUpdated.getIssueById(10).get().getTitle());

    // Labels

    try {
      modelUpdated.getLabelByActualName(null);
    } catch (AssertionError ignored) {
    }
    try {
      modelUpdated.getLabelByActualName("");
    } catch (AssertionError ignored) {
    }

    assertEquals(
        Optional.<TurboLabel>empty(),
        modelUpdated.getLabelByActualName("Label " + (DummyRepoState.NO_OF_DUMMY_ISSUES + 1)));
    assertEquals("Label 10", modelUpdated.getLabelByActualName("Label 10").get().getFullName());

    // Milestones

    try {
      modelUpdated.getMilestoneById(-1);
    } catch (AssertionError ignored) {
    }
    try {
      modelUpdated.getMilestoneById(0);
    } catch (AssertionError ignored) {
    }

    try {
      modelUpdated.getMilestoneByTitle(null);
    } catch (AssertionError ignored) {
    }
    try {
      modelUpdated.getMilestoneByTitle("");
    } catch (AssertionError ignored) {
    }

    assertEquals(
        Optional.<TurboMilestone>empty(),
        modelUpdated.getMilestoneById(DummyRepoState.NO_OF_DUMMY_ISSUES + 1));
    assertEquals("Milestone 10", modelUpdated.getMilestoneById(10).get().getTitle());

    assertEquals(
        Optional.<TurboMilestone>empty(),
        modelUpdated.getMilestoneByTitle("Milestone " + (DummyRepoState.NO_OF_DUMMY_ISSUES + 1)));
    assertEquals("Milestone 10", modelUpdated.getMilestoneByTitle("Milestone 10").get().getTitle());

    // Users

    try {
      modelUpdated.getUserByLogin(null);
    } catch (AssertionError ignored) {
    }
    try {
      modelUpdated.getUserByLogin("");
    } catch (AssertionError ignored) {
    }

    assertEquals(
        Optional.<TurboUser>empty(),
        modelUpdated.getUserByLogin("User " + (DummyRepoState.NO_OF_DUMMY_ISSUES + 1)));
    assertEquals("User 10", modelUpdated.getUserByLogin("User 10").get().getLoginName());
  }