42
42
import org .zendesk .client .v2 .model .Type ;
43
43
import org .zendesk .client .v2 .model .User ;
44
44
import org .zendesk .client .v2 .model .View ;
45
+ import org .zendesk .client .v2 .model .Via ;
45
46
import org .zendesk .client .v2 .model .dynamic .DynamicContentItem ;
46
47
import org .zendesk .client .v2 .model .dynamic .DynamicContentItemVariant ;
47
48
import org .zendesk .client .v2 .model .events .Event ;
62
63
import java .util .Collections ;
63
64
import java .util .Date ;
64
65
import java .util .HashSet ;
66
+ import java .util .HashMap ;
65
67
import java .util .List ;
66
68
import java .util .Objects ;
67
69
import java .util .Optional ;
68
70
import java .util .Properties ;
69
71
import java .util .Random ;
70
72
import java .util .Set ;
73
+ import java .util .Map ;
71
74
import java .util .UUID ;
72
75
import java .util .concurrent .TimeUnit ;
73
76
import java .util .stream .Collectors ;
@@ -113,6 +116,9 @@ public class RealSmokeTest {
113
116
private static final Random RANDOM = new Random ();
114
117
private static final String TICKET_COMMENT1 = "Please ignore this ticket" ;
115
118
private static final String TICKET_COMMENT2 = "Yes ignore this ticket" ;
119
+ private static final String VIA_CHANNEL = "chat" ;
120
+ private static final Map <String , Object > VIA_SOURCE = new HashMap <>();
121
+ private static final Via VIA = new Via ();
116
122
117
123
private static Properties config ;
118
124
@@ -134,6 +140,12 @@ public static void loadConfig() {
134
140
Awaitility .setDefaultPollInterval (20 , TimeUnit .SECONDS );
135
141
}
136
142
143
+ @ BeforeClass
144
+ public static void initializeVia () {
145
+ VIA .setChannel (VIA_CHANNEL );
146
+ VIA .setSource (VIA_SOURCE );
147
+ }
148
+
137
149
public void assumeHaveToken () {
138
150
assumeThat ("We have a username" , config .getProperty ("username" ), not (isEmptyOrNullString ()));
139
151
assumeThat ("We have a token" , config .getProperty ("token" ), not (isEmptyOrNullString ()));
@@ -1897,6 +1909,7 @@ public void getTicketCommentsShouldBeAscending() throws Exception {
1897
1909
ticket = instance .createTicket (t );
1898
1910
final Comment comment = new Comment (TICKET_COMMENT2 );
1899
1911
comment .setType (CommentType .COMMENT );
1912
+ comment .setVia (VIA );
1900
1913
instance .createComment (ticket .getId (), comment );
1901
1914
Iterable <Comment > ticketCommentsIt = instance .getTicketComments (ticket .getId ());
1902
1915
List <Comment > comments = new ArrayList <>();
@@ -1924,6 +1937,7 @@ public void getTicketCommentsDescending() throws Exception {
1924
1937
ticket = instance .createTicket (t );
1925
1938
final Comment comment = new Comment (TICKET_COMMENT2 );
1926
1939
comment .setType (CommentType .COMMENT );
1940
+ comment .setVia (VIA );
1927
1941
instance .createComment (ticket .getId (), comment );
1928
1942
Iterable <Comment > ticketCommentsIt = instance .getTicketComments (ticket .getId (), SortOrder .DESCENDING );
1929
1943
List <Comment > comments = new ArrayList <>();
@@ -1932,8 +1946,10 @@ public void getTicketCommentsDescending() throws Exception {
1932
1946
assertThat (comments .size (), is (2 ));
1933
1947
assertThat (comments .get (0 ).getBody (), containsString (TICKET_COMMENT2 ));
1934
1948
assertThat (comments .get (0 ).getType (), is (CommentType .COMMENT ));
1949
+ assertThat (comments .get (0 ).getVia (), is (VIA ));
1935
1950
assertThat (comments .get (1 ).getBody (), containsString (TICKET_COMMENT1 ));
1936
1951
assertThat (comments .get (1 ).getType (), is (CommentType .COMMENT ));
1952
+ assertThat (comments .get (1 ).getVia (), is (VIA ));
1937
1953
} finally {
1938
1954
if (ticket != null ) {
1939
1955
instance .deleteTicket (ticket .getId ());
0 commit comments