NCMBPushService extends NCMBService { public NCMBPush fetchPush(String pushId) throws NCMBException { if (pushId == null) { throw new NCMBException(NCMBException.INVALID_JSON, "pushId is must not be null."); } RequestParams request = createRequestParams(pushId, null, null, NCMBRequest.HTTP_METHOD_GET); NCMBResponse response = sendRequest(request); if (response.statusCode != HTTP_STATUS_PUSH_GOTTEN) { throw new NCMBException(NCMBException.NOT_EFFICIENT_VALUE, "Gotten failed."); } return new NCMBPush(response.responseData); } NCMBPushService(NCMBContext context); JSONObject sendPush(JSONObject params); void sendPushInBackground(final JSONObject params, ExecuteServiceCallback callback); JSONObject updatePush(String pushId, JSONObject params); void updatePushInBackground(final String pushId, final JSONObject params, final ExecuteServiceCallback callback); void deletePush(String pushId); void deletePushInBackground(String pushId, DoneCallback callback); NCMBPush fetchPush(String pushId); void fetchPushInBackground(final String pushId, final FetchCallback callback); List searchPush(JSONObject conditions); void searchPushInBackground(JSONObject conditions, final SearchPushCallback callback); void sendPushReceiptStatusInBackground(String pushId, ExecuteServiceCallback callback); static final String SERVICE_PATH; static final int HTTP_STATUS_PUSH_CREATED; static final int HTTP_STATUS_PUSH_UPDATED; static final int HTTP_STATUS_PUSH_DELETED; static final int HTTP_STATUS_PUSH_GOTTEN; static final int HTTP_STATUS_PUSH_RECEIPTSTATUS; }
@Test public void getPush() throws Exception { Exception error = null; JSONObject json = null; try { NCMBPushService pushService = (NCMBPushService) NCMB.factory(NCMB.ServiceType.PUSH); NCMBPush push = pushService.fetchPush("7FrmPTBKSNtVjajm"); Assert.assertNull(error); Assert.assertEquals("7FrmPTBKSNtVjajm", push.getString("objectId")); Assert.assertEquals("http: } catch (NCMBException e) { Assert.fail(e.getMessage()); } }