Skip to content

Commit 081611b

Browse files
authored
Merge pull request #521 from venediktov/getTicketComments/extend-comment-class
2 parents 7b28607 + 9ec287a commit 081611b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/main/java/org/zendesk/client/v2/model/Comment.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class Comment implements Serializable {
2424
private Date createdAt;
2525
private Boolean publicComment;
2626
private CommentType type;
27+
private Via via;
2728

2829

2930
public Comment() {
@@ -115,6 +116,13 @@ public void setType(CommentType type) {
115116
this.type = type;
116117
}
117118

119+
@JsonProperty("via")
120+
public Via getVia() {
121+
return via;
122+
}
123+
124+
public void setVia(Via via) { this.via = via; }
125+
118126
@Override
119127
public String toString() {
120128
return "Comment{" + "id=" + id +
@@ -123,6 +131,7 @@ public String toString() {
123131
", attachments=" + attachments +
124132
", createdAt=" + createdAt +
125133
", uploads=" + uploads +
134+
", via=" + via +
126135
'}';
127136
}
128-
}
137+
}

src/test/java/org/zendesk/client/v2/RealSmokeTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,8 +1905,12 @@ public void getTicketCommentsShouldBeAscending() throws Exception {
19051905
assertThat(comments.size(), is(2));
19061906
assertThat(comments.get(0).getBody(), containsString(TICKET_COMMENT1));
19071907
assertThat(comments.get(0).getType(), is(CommentType.COMMENT));
1908+
assertNotNull(comments.get(0).getVia());
1909+
assertThat(comments.get(0).getVia().getChannel(), is("api"));
19081910
assertThat(comments.get(1).getBody(), containsString(TICKET_COMMENT2));
19091911
assertThat(comments.get(1).getType(), is(CommentType.COMMENT));
1912+
assertNotNull(comments.get(1).getVia());
1913+
assertThat(comments.get(1).getVia().getChannel(), is("api"));
19101914
} finally {
19111915
if (ticket != null) {
19121916
instance.deleteTicket(ticket.getId());
@@ -1932,8 +1936,12 @@ public void getTicketCommentsDescending() throws Exception {
19321936
assertThat(comments.size(), is(2));
19331937
assertThat(comments.get(0).getBody(), containsString(TICKET_COMMENT2));
19341938
assertThat(comments.get(0).getType(), is(CommentType.COMMENT));
1939+
assertNotNull(comments.get(0).getVia());
1940+
assertThat(comments.get(0).getVia().getChannel(), is("api"));
19351941
assertThat(comments.get(1).getBody(), containsString(TICKET_COMMENT1));
19361942
assertThat(comments.get(1).getType(), is(CommentType.COMMENT));
1943+
assertNotNull(comments.get(1).getVia());
1944+
assertThat(comments.get(1).getVia().getChannel(), is("api"));
19371945
} finally {
19381946
if (ticket != null) {
19391947
instance.deleteTicket(ticket.getId());

0 commit comments

Comments
 (0)