@Test
 public void authenticationFail() {
   String masterSecret = "2b38ce69b1de2a7fa95706e2";
   JPushClient client = new JPushClient(masterSecret, appKey);
   PushPayload payload = PushPayload.alertAll(ALERT);
   try {
     client.sendPush(payload);
   } catch (APIConnectionException e) {
     e.printStackTrace();
   } catch (APIRequestException e) {
     assertEquals(AUTHENTICATION_FAIL, e.getErrorCode());
   }
 }
  @Test
  public void appKeyNotExist() {
    String appKey = "dd1066407b044738b6479274";
    JPushClient client = new JPushClient(masterSecret, appKey);
    PushPayload payload = PushPayload.alertAll(ALERT);

    try {
      client.sendPush(payload);
    } catch (APIConnectionException e) {
      e.printStackTrace();
    } catch (APIRequestException e) {
      assertEquals(APPKEY_NOT_EXIST, e.getErrorCode());
    }
  }
 /**
  * 快捷地构建推送对象:所有平台,所有设备,内容为 ALERT 的通知。
  *
  * @return
  */
 private static PushPayload buildPushObject_all_all_alert(String message) {
   return PushPayload.alertAll(message);
 }
Exemplo n.º 4
0
 public PushPayload buildPushObject_all_all_alert(String msg) {
   return PushPayload.alertAll(msg);
 }