Skip to content

Commit

Permalink
Merge pull request #715 from PierreBtz/pbeitz/fix-test
Browse files Browse the repository at this point in the history
[chore] Await a bit for ticket creation
  • Loading branch information
PierreBtz authored Sep 17, 2024
2 parents 2fc452e + e8b5b96 commit fe83f74
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 fe83f74

Please sign in to comment.