Skip to content

Commit f252531

Browse files
committed
Mods to support Issue clased_at property (#164).
1 parent 8647a1d commit f252531

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

src/main/java/org/gitlab4j/api/models/Issue.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public class Issue {
1818
private Author author;
1919
private Boolean confidential;
2020
private Date createdAt;
21+
private Date updatedAt;
22+
private Date closedAt;
23+
private User closedBy;
2124
private String description;
2225
private Date dueDate;
2326
private Integer id;
@@ -28,7 +31,6 @@ public class Issue {
2831
private IssueState state;
2932
private Boolean subscribed;
3033
private String title;
31-
private Date updatedAt;
3234
private Integer userNotesCount;
3335
private String webUrl;
3436
private TimeStats timeStats;
@@ -153,6 +155,22 @@ public void setUpdatedAt(Date updatedAt) {
153155
this.updatedAt = updatedAt;
154156
}
155157

158+
public Date getClosedAt() {
159+
return closedAt;
160+
}
161+
162+
public void setClosedAt(Date closedAt) {
163+
this.closedAt = closedAt;
164+
}
165+
166+
public User getClosedBy() {
167+
return closedBy;
168+
}
169+
170+
public void setClosedBy(User closedBy) {
171+
this.closedBy = closedBy;
172+
}
173+
156174
public Integer getUserNotesCount() {
157175
return userNotesCount;
158176
}

src/test/java/org/gitlab4j/api/TestIssuesApi.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,26 @@ public void testCloseIssueJustCreated() throws GitLabApiException {
202202
assertEquals(issue.getId(), closedIssue.getId());
203203
}
204204

205+
@Test
206+
public void testCloseIssueClosedAt() throws GitLabApiException {
207+
208+
assertNotNull(testProject);
209+
Integer projectId = testProject.getId();
210+
Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION);
211+
assertNull(issue.getClosedAt());
212+
assertNull(issue.getClosedBy());
213+
214+
Issue closedIssue = gitLabApi.getIssuesApi().closeIssue(projectId, issue.getIid());
215+
assertNotNull(closedIssue);
216+
assertEquals(IssueState.CLOSED, closedIssue.getState());
217+
assertEquals(issue.getId(), closedIssue.getId());
218+
219+
closedIssue = gitLabApi.getIssuesApi().getIssue(projectId, issue.getIid());
220+
assertNotNull(closedIssue);
221+
assertEquals(IssueState.CLOSED, closedIssue.getState());
222+
assertNotNull(closedIssue.getClosedAt());
223+
}
224+
205225
@Test
206226
public void testDeleteIssue() throws GitLabApiException {
207227

src/test/resources/org/gitlab4j/api/issue.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232
"title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
3333
"updated_at" : "2016-01-04T15:31:46.176Z",
3434
"created_at" : "2016-01-04T15:31:46.176Z",
35+
"closed_at" : "2016-01-05T15:31:46.176Z",
36+
"closed_by" : {
37+
"state" : "active",
38+
"web_url" : "https://gitlab.example.com/root",
39+
"username" : "root",
40+
"id" : 1,
41+
"name" : "Administrator"
42+
},
3543
"subscribed": false,
3644
"user_notes_count": 1,
3745
"web_url": "http://example.com/example/example/issues/1",

0 commit comments

Comments
 (0)