MessageEventsQueryBuilder { public void buildQuery(Endpoint endpoint) { if (this.bounceClasses.size() > 0) { endpoint.addParam("bounce_classes", setAsString(this.bounceClasses, ",")); } if (this.campaignIds.size() > 0) { endpoint.addParam("campaign_ids", setAsString(this.campaignIds, ",")); } if (this.events.size() > 0) { endpoint.addParam("events", setAsString(this.events, ",")); } if (this.friendlyFroms.size() > 0) { endpoint.addParam("friendly_froms", setAsString(this.friendlyFroms, ",")); } if (StringUtils.isNotEmpty(this.fromDateTime)) { endpoint.addParam("from", this.fromDateTime); } if (StringUtils.isNotEmpty(this.toDateTime)) { endpoint.addParam("to", this.toDateTime); } if (this.messageIds.size() > 0) { endpoint.addParam("message_ids", setAsString(this.messageIds, ",")); } if (StringUtils.isNotEmpty(this.reason)) { endpoint.addParam("reason", this.reason); } if (this.recipients.size() > 0) { endpoint.addParam("recipients", setAsString(this.recipients, ",")); } if (this.subaccounts.size() > 0) { endpoint.addParam("subaccounts", setAsString(this.subaccounts, ",")); } if (this.templateIds.size() > 0) { endpoint.addParam("template_ids", setAsString(this.templateIds, ",")); } if (StringUtils.isNotEmpty(this.timezone)) { endpoint.addParam("timezone", this.timezone); } if (this.transmissionIds.size() > 0) { endpoint.addParam("transmission_ids", setAsString(this.transmissionIds, ",")); } }  void addBounceClass(BounceClass bounceClass); void addCampaignId(String cid); void addEventType(EventType type); void addFriendlyFrom(String from); void setFromDateTime(String dateTime); void setToDateTime(String dateTime); void addMessageId(String messageId); void setReason(String reason); void addRecipient(String recipient); void addSubAccount(String subaccount); void addTemplateId(String tid); void setTimezone(String timeZone); void addTransmissionId(String tid); void buildQuery(Endpoint endpoint); void setSortOutput(boolean sortOutput);  }
@Test public void testNoQuerySet() { MessageEventsQueryBuilder queryBuilder = new MessageEventsQueryBuilder(); Endpoint ep = new Endpoint("test"); queryBuilder.buildQuery(ep); String query = ep.toString(); Assert.assertNotNull(query); Assert.assertEquals("/test", query); }