@Test(expected=IncompleteMessageException.class) public void sendMessage_toNone_noPush() { urbanAirship.richPushOperations().sendMessage(OutgoingMessage.builder("Hello").build()); }
public void sendMessage(OutgoingMessage message) { if (message.hasRecipients()) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<OutgoingMessage> requestEntity = new HttpEntity<OutgoingMessage>(message, headers); restOperations.exchange(AIRMAIL_URL, HttpMethod.POST, requestEntity, String.class); } else { throw new IncompleteMessageException("A message must have at least one user, alias, or tag as recipient unless sending as a broadcast."); } }
RichPushTemplate implements RichPushOperations { public void sendMessage(OutgoingMessage message) { if (message.hasRecipients()) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<OutgoingMessage> requestEntity = new HttpEntity<OutgoingMessage>(message, headers); restOperations.exchange(AIRMAIL_URL, HttpMethod.POST, requestEntity, String.class); } else { throw new IncompleteMessageException("A message must have at least one user, alias, or tag as recipient unless sending as a broadcast."); } } }
RichPushTemplate implements RichPushOperations { public void sendMessage(OutgoingMessage message) { if (message.hasRecipients()) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<OutgoingMessage> requestEntity = new HttpEntity<OutgoingMessage>(message, headers); restOperations.exchange(AIRMAIL_URL, HttpMethod.POST, requestEntity, String.class); } else { throw new IncompleteMessageException("A message must have at least one user, alias, or tag as recipient unless sending as a broadcast."); } } RichPushTemplate(RestOperations restOperations); }
RichPushTemplate implements RichPushOperations { public void sendMessage(OutgoingMessage message) { if (message.hasRecipients()) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<OutgoingMessage> requestEntity = new HttpEntity<OutgoingMessage>(message, headers); restOperations.exchange(AIRMAIL_URL, HttpMethod.POST, requestEntity, String.class); } else { throw new IncompleteMessageException("A message must have at least one user, alias, or tag as recipient unless sending as a broadcast."); } } RichPushTemplate(RestOperations restOperations); void sendMessage(OutgoingMessage message); void sendBroadcast(OutgoingMessage message); }
RichPushTemplate implements RichPushOperations { public void sendMessage(OutgoingMessage message) { if (message.hasRecipients()) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<OutgoingMessage> requestEntity = new HttpEntity<OutgoingMessage>(message, headers); restOperations.exchange(AIRMAIL_URL, HttpMethod.POST, requestEntity, String.class); } else { throw new IncompleteMessageException("A message must have at least one user, alias, or tag as recipient unless sending as a broadcast."); } } RichPushTemplate(RestOperations restOperations); void sendMessage(OutgoingMessage message); void sendBroadcast(OutgoingMessage message);  }