Skip to content

Commit d8d775c

Browse files
author
Vvenediktov
committed
test Via object against zendesk instance, correct the tests
1 parent 0f87b8d commit d8d775c

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

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

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import org.zendesk.client.v2.model.Type;
4343
import org.zendesk.client.v2.model.User;
4444
import org.zendesk.client.v2.model.View;
45-
import org.zendesk.client.v2.model.Via;
4645
import org.zendesk.client.v2.model.dynamic.DynamicContentItem;
4746
import org.zendesk.client.v2.model.dynamic.DynamicContentItemVariant;
4847
import org.zendesk.client.v2.model.events.Event;
@@ -63,14 +62,12 @@
6362
import java.util.Collections;
6463
import java.util.Date;
6564
import java.util.HashSet;
66-
import java.util.HashMap;
6765
import java.util.List;
6866
import java.util.Objects;
6967
import java.util.Optional;
7068
import java.util.Properties;
7169
import java.util.Random;
7270
import java.util.Set;
73-
import java.util.Map;
7471
import java.util.UUID;
7572
import java.util.concurrent.TimeUnit;
7673
import java.util.stream.Collectors;
@@ -116,9 +113,6 @@ public class RealSmokeTest {
116113
private static final Random RANDOM = new Random();
117114
private static final String TICKET_COMMENT1 = "Please ignore this ticket";
118115
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();
122116

123117
private static Properties config;
124118

@@ -140,11 +134,6 @@ public static void loadConfig() {
140134
Awaitility.setDefaultPollInterval(20, TimeUnit.SECONDS);
141135
}
142136

143-
@BeforeClass
144-
public static void initializeVia() {
145-
VIA.setChannel(VIA_CHANNEL);
146-
VIA.setSource(VIA_SOURCE);
147-
}
148137

149138
public void assumeHaveToken() {
150139
assumeThat("We have a username", config.getProperty("username"), not(isEmptyOrNullString()));
@@ -1909,7 +1898,6 @@ public void getTicketCommentsShouldBeAscending() throws Exception {
19091898
ticket = instance.createTicket(t);
19101899
final Comment comment = new Comment(TICKET_COMMENT2);
19111900
comment.setType(CommentType.COMMENT);
1912-
comment.setVia(VIA);
19131901
instance.createComment(ticket.getId(), comment);
19141902
Iterable<Comment> ticketCommentsIt = instance.getTicketComments(ticket.getId());
19151903
List<Comment> comments = new ArrayList<>();
@@ -1918,9 +1906,12 @@ public void getTicketCommentsShouldBeAscending() throws Exception {
19181906
assertThat(comments.size(), is(2));
19191907
assertThat(comments.get(0).getBody(), containsString(TICKET_COMMENT1));
19201908
assertThat(comments.get(0).getType(), is(CommentType.COMMENT));
1909+
assertNotNull(comments.get(0).getVia());
1910+
assertThat(comments.get(0).getVia().getChannel(), is("api"));
19211911
assertThat(comments.get(1).getBody(), containsString(TICKET_COMMENT2));
19221912
assertThat(comments.get(1).getType(), is(CommentType.COMMENT));
1923-
assertThat(comments.get(1).getVia(), is(VIA));
1913+
assertNotNull(comments.get(1).getVia());
1914+
assertThat(comments.get(1).getVia().getChannel(), is("api"));
19241915
} finally {
19251916
if (ticket != null) {
19261917
instance.deleteTicket(ticket.getId());
@@ -1938,7 +1929,6 @@ public void getTicketCommentsDescending() throws Exception {
19381929
ticket = instance.createTicket(t);
19391930
final Comment comment = new Comment(TICKET_COMMENT2);
19401931
comment.setType(CommentType.COMMENT);
1941-
comment.setVia(VIA);
19421932
instance.createComment(ticket.getId(), comment);
19431933
Iterable<Comment> ticketCommentsIt = instance.getTicketComments(ticket.getId(), SortOrder.DESCENDING);
19441934
List<Comment> comments = new ArrayList<>();
@@ -1947,9 +1937,12 @@ public void getTicketCommentsDescending() throws Exception {
19471937
assertThat(comments.size(), is(2));
19481938
assertThat(comments.get(0).getBody(), containsString(TICKET_COMMENT2));
19491939
assertThat(comments.get(0).getType(), is(CommentType.COMMENT));
1950-
assertThat(comments.get(0).getVia(), is(VIA));
1940+
assertNotNull(comments.get(0).getVia());
1941+
assertThat(comments.get(0).getVia().getChannel(), is("api"));
19511942
assertThat(comments.get(1).getBody(), containsString(TICKET_COMMENT1));
19521943
assertThat(comments.get(1).getType(), is(CommentType.COMMENT));
1944+
assertNotNull(comments.get(1).getVia());
1945+
assertThat(comments.get(1).getVia().getChannel(), is("api"));
19531946
} finally {
19541947
if (ticket != null) {
19551948
instance.deleteTicket(ticket.getId());

0 commit comments

Comments
 (0)