Skip to content

Commit

Permalink
#717 Started implementing GitlabIssues.
Browse files Browse the repository at this point in the history
- fixed test coverage for GitlabIssue.
  • Loading branch information
criske committed Nov 26, 2020
1 parent 44a28bd commit f778237
Showing 1 changed file with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,49 @@ public void returnsAuthor() {
);
}

/**
* GitlabIssue can return its assignee.
*/
@Test
public void returnsAssigneeUsername() {
final Issue issue = new GitlabIssue(
URI.create("https://gitlab.com/api/v4/projects"
+ "/john%2Ftest/merge_requests/1"),
Json.createObjectBuilder()
.add("assignee",
Json.createObjectBuilder()
.add("username", "amihaiemil")
.build()
)
.build(),
Mockito.mock(Storage.class),
Mockito.mock(JsonResources.class)
);
MatcherAssert.assertThat(
issue.assignee(),
Matchers.equalTo("amihaiemil")
);
}

/**
* GitlabIssue can return no assignee.
*/
@Test
public void returnsNoAssignee() {
final Issue issue = new GitlabIssue(
URI.create("https://gitlab.com/api/v4/projects"
+ "/john%2Ftest/merge_requests/1"),
Json.createObjectBuilder()
.build(),
Mockito.mock(Storage.class),
Mockito.mock(JsonResources.class)
);
MatcherAssert.assertThat(
issue.assignee(),
Matchers.nullValue()
);
}

/**
* GitlabIssue can return its body.
*/
Expand Down Expand Up @@ -356,4 +399,23 @@ public void returnsIsClosedFalse() {
Matchers.is(Boolean.FALSE)
);
}

/**
* GitlabIssue can return its wrapped json object.
*/
@Test
public void returnsItsJson(){
final JsonObject json = JsonObject.EMPTY_JSON_OBJECT;
final Issue issue = new GitlabIssue(
URI.create("https://gitlab.com/api/v4/projects"
+ "/john%2Ftest/issues/1"),
json,
Mockito.mock(Storage.class),
Mockito.mock(JsonResources.class)
);
MatcherAssert.assertThat(
issue.json(),
Matchers.equalTo(json)
);
}
}

0 comments on commit f778237

Please sign in to comment.