/** - 内容:objectId未設定でdelete出来ない事を確認する - 結果:エラーが出る事 */ @Test public void delete_error_notSetObjectId() throws Exception { // delete NCMBException error = null; NCMBPush push = new NCMBPush(); try { push.delete(); } catch (NCMBException e) { error = e; } Assert.assertNotNull(error); Assert.assertEquals("pushId is must not be null.", error.getMessage()); }
/** - 内容:deleteが成功することを確認する - 結果:同期でプッシュ情報が削除出来る事 */ @Test public void delete() throws Exception { // delete NCMBPush push = new NCMBPush(); push.setObjectId("7FrmPTBKSNtVjajm"); try { push.delete(); } catch (NCMBException e) { Assert.fail(e.getMessage()); } Assert.assertNull(push.getObjectId()); }
/** - 内容:fetchが成功することを確認する - 結果:同期でプッシュ情報が取得出来る事 */ @Test public void fetch() throws Exception { // get NCMBException error = null; NCMBPush push = new NCMBPush(); push.setObjectId("7FrmPTBKSNtVjajm"); try { push.fetch(); } catch (NCMBException e) { Assert.fail(e.getMessage()); } checkGetResponse(push); }
/** - 内容:即時配信フラグと配信時刻が同時に設定出来ない事を確認する - 結果:エラーが出る事 */ @Test public void send_error_sameTime() throws Exception { // post NCMBException error = null; JSONObject params = new JSONObject(); params.put("immediateDeliveryFlag", true); params.put("deliveryTime", new Date()); NCMBPush push = new NCMBPush(params); try { push.send(); } catch (NCMBException e) { error = e; } // check Assert.assertNotNull(error); Assert.assertEquals( "'deliveryTime' and 'immediateDeliveryFlag' can not be set at the same time.", error.getMessage()); }