Skip to content

Commit

Permalink
[chore] Await a bit for ticket creation
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreBtz committed Sep 17, 2024
1 parent 0c24742 commit e8b5b96
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/test/java/org/zendesk/client/v2/RealSmokeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2771,17 +2771,17 @@ public void getUnresolvedViewReturnsANewlyCreatedTicket() throws Exception {
Ticket ticket = instance.createTicket(newTestTicket());
try {
assertThat(ticket.getId(), notNullValue());

Optional<Ticket> maybeTicket =
StreamSupport.stream(instance.getView(UNRESOLVED_TICKETS_VIEW_ID).spliterator(), false)
.filter(t -> Objects.equals(t.getId(), ticket.getId()))
.findFirst();
assertTrue(maybeTicket.isPresent());
await().until(() -> lookForTicket(ticket));
} finally {
instance.deleteTicket(ticket.getId());
}
}

private boolean lookForTicket(Ticket ticket) {
return StreamSupport.stream(instance.getView(UNRESOLVED_TICKETS_VIEW_ID).spliterator(), false)
.anyMatch(t -> Objects.equals(t.getId(), ticket.getId()));
}

@Test
public void getViewReturnsTheUnresolvedView() throws Exception {
createClientWithTokenOrPassword();
Expand Down

0 comments on commit e8b5b96

Please sign in to comment.