|
6 | 6 | import android.support.test.runner.AndroidJUnitRunner; |
7 | 7 | import android.util.Log; |
8 | 8 | import com.cometchat.pro.constants.CometChatConstants; |
| 9 | +import com.cometchat.pro.core.AppSettings; |
9 | 10 | import com.cometchat.pro.core.BannedGroupMembersRequest; |
10 | 11 | import com.cometchat.pro.core.BlockedUsersRequest; |
11 | 12 | import com.cometchat.pro.core.CometChat; |
@@ -64,8 +65,8 @@ public class ExampleInstrumentedTest { |
64 | 65 | @Test |
65 | 66 | public void init() { |
66 | 67 | CountDownLatch countDownLatch = new CountDownLatch(1); |
67 | | - |
68 | | - CometChat.init(appContext, StringContract.AppDetails.API_KEY, new CometChat.CallbackListener<String>() { |
| 68 | + AppSettings appSettings=new AppSettings.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion("us").build(); |
| 69 | + CometChat.init(appContext, StringContract.AppDetails.API_KEY,appSettings, new CometChat.CallbackListener<String>() { |
69 | 70 | @Override |
70 | 71 | public void onSuccess(String s) { |
71 | 72 | Log.d(TAG, "init onSuccess: " + s); |
@@ -188,7 +189,7 @@ public void sendTextMessage() { |
188 | 189 |
|
189 | 190 | CountDownLatch countDownLatch = new CountDownLatch(1); |
190 | 191 |
|
191 | | - TextMessage textMessage = new TextMessage("superhero1", "Hello",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER); |
| 192 | + TextMessage textMessage = new TextMessage("superhero1", "Hello", CometChatConstants.RECEIVER_TYPE_USER); |
192 | 193 |
|
193 | 194 | CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() { |
194 | 195 | @Override |
@@ -222,7 +223,7 @@ public void sendMessageWithInvalidUID() { |
222 | 223 |
|
223 | 224 | CountDownLatch countDownLatch = new CountDownLatch(1); |
224 | 225 |
|
225 | | - TextMessage textMessage = new TextMessage("", "hello",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER); |
| 226 | + TextMessage textMessage = new TextMessage("", "hello", CometChatConstants.RECEIVER_TYPE_USER); |
226 | 227 |
|
227 | 228 | CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() { |
228 | 229 | @Override |
@@ -253,7 +254,7 @@ public void onError(CometChatException e) { |
253 | 254 | public void sendTextMessageWithImageType() { |
254 | 255 | CountDownLatch countDownLatch = new CountDownLatch(1); |
255 | 256 |
|
256 | | - TextMessage textMessage = new TextMessage(UID, "Hello",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER); |
| 257 | + TextMessage textMessage = new TextMessage(UID, "Hello", CometChatConstants.RECEIVER_TYPE_USER); |
257 | 258 |
|
258 | 259 | CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() { |
259 | 260 | @Override |
@@ -284,7 +285,7 @@ public void sendTextMessageWithNullText() { |
284 | 285 | CountDownLatch countDownLatch = new CountDownLatch(1); |
285 | 286 |
|
286 | 287 |
|
287 | | - TextMessage textMessage = new TextMessage(UID, null, CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER); |
| 288 | + TextMessage textMessage = new TextMessage(UID, null, CometChatConstants.RECEIVER_TYPE_USER); |
288 | 289 |
|
289 | 290 | CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() { |
290 | 291 | @Override |
@@ -316,7 +317,7 @@ public void sendTextMessageWithInvalidPara() { |
316 | 317 | CountDownLatch countDownLatch = new CountDownLatch(1); |
317 | 318 |
|
318 | 319 |
|
319 | | - TextMessage textMessage = new TextMessage(UID, null,CometChatConstants.MESSAGE_TYPE_TEXT,CometChatConstants.CATEGORY_MESSAGE); |
| 320 | + TextMessage textMessage = new TextMessage(UID, null,CometChatConstants.CATEGORY_MESSAGE); |
320 | 321 |
|
321 | 322 | CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() { |
322 | 323 | @Override |
@@ -348,7 +349,7 @@ public void onError(CometChatException e) { |
348 | 349 | public void sendTextMessageWithGroupType() { |
349 | 350 | CountDownLatch countDownLatch = new CountDownLatch(1); |
350 | 351 |
|
351 | | - TextMessage textMessage = new TextMessage(UID, "Hello", CometChatConstants.MESSAGE_TYPE_TEXT,CometChatConstants.RECEIVER_TYPE_GROUP); |
| 352 | + TextMessage textMessage = new TextMessage(UID, "Hello",CometChatConstants.RECEIVER_TYPE_GROUP); |
352 | 353 |
|
353 | 354 | CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() { |
354 | 355 | @Override |
@@ -378,7 +379,7 @@ public void sendTextMessageInvalidTypeAndEmptyMessage() { |
378 | 379 |
|
379 | 380 | CountDownLatch countDownLatch = new CountDownLatch(1); |
380 | 381 |
|
381 | | - TextMessage textMessage = new TextMessage(UID, "",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_GROUP); |
| 382 | + TextMessage textMessage = new TextMessage(UID, "", CometChatConstants.RECEIVER_TYPE_GROUP); |
382 | 383 |
|
383 | 384 | CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() { |
384 | 385 | @Override |
@@ -612,7 +613,7 @@ public void sendTextMessageWithNullPara() { |
612 | 613 | // customData.put("lattitue","19.0760"); |
613 | 614 | // customData.put("longitude","72.8777"); |
614 | 615 |
|
615 | | - TextMessage textMessage = new TextMessage(null, null, CometChatConstants.MESSAGE_TYPE_TEXT,null); |
| 616 | + TextMessage textMessage = new TextMessage(null, null, null); |
616 | 617 |
|
617 | 618 | CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() { |
618 | 619 | @Override |
@@ -685,7 +686,7 @@ public void sendTextMessageWithNullMessageAndReceiverType() { |
685 | 686 |
|
686 | 687 | CountDownLatch countDownLatch = new CountDownLatch(1); |
687 | 688 |
|
688 | | - TextMessage textMessage = new TextMessage(UID, "Hello", CometChatConstants.MESSAGE_TYPE_TEXT,null); |
| 689 | + TextMessage textMessage = new TextMessage(UID, "Hello", null); |
689 | 690 |
|
690 | 691 | CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() { |
691 | 692 | @Override |
@@ -719,7 +720,7 @@ public void sendTextMessageWithMetaData() { |
719 | 720 | try { |
720 | 721 | CountDownLatch countDownLatch = new CountDownLatch(1); |
721 | 722 |
|
722 | | - TextMessage textMessage = new TextMessage(UID, "Hello",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER); |
| 723 | + TextMessage textMessage = new TextMessage(UID, "Hello", CometChatConstants.RECEIVER_TYPE_USER); |
723 | 724 |
|
724 | 725 | JSONObject customData = new JSONObject(); |
725 | 726 | customData.put("lattitue", "19.0760"); |
@@ -759,7 +760,7 @@ public void sendTextMessageWithNullMetaData() { |
759 | 760 | try { |
760 | 761 | CountDownLatch countDownLatch = new CountDownLatch(1); |
761 | 762 |
|
762 | | - TextMessage textMessage = new TextMessage(UID, "Hello",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER); |
| 763 | + TextMessage textMessage = new TextMessage(UID, "Hello", CometChatConstants.RECEIVER_TYPE_USER); |
763 | 764 |
|
764 | 765 | textMessage.setMetadata(null); |
765 | 766 |
|
@@ -795,7 +796,7 @@ public void sendTextMessageWithMetaGroupType() { |
795 | 796 | try { |
796 | 797 | CountDownLatch countDownLatch = new CountDownLatch(1); |
797 | 798 |
|
798 | | - TextMessage textMessage = new TextMessage(GUID, "Hello", CometChatConstants.MESSAGE_TYPE_TEXT,CometChatConstants.RECEIVER_TYPE_GROUP); |
| 799 | + TextMessage textMessage = new TextMessage(GUID, "Hello",CometChatConstants.RECEIVER_TYPE_GROUP); |
799 | 800 |
|
800 | 801 | JSONObject customData = new JSONObject(); |
801 | 802 |
|
@@ -837,7 +838,7 @@ public void sendTextMessageWithMetaAndMUID() { |
837 | 838 | try { |
838 | 839 | CountDownLatch countDownLatch = new CountDownLatch(1); |
839 | 840 |
|
840 | | - TextMessage textMessage = new TextMessage(GUID, "Hello",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_GROUP); |
| 841 | + TextMessage textMessage = new TextMessage(GUID, "Hello", CometChatConstants.RECEIVER_TYPE_GROUP); |
841 | 842 |
|
842 | 843 | JSONObject customData = new JSONObject(); |
843 | 844 |
|
@@ -1176,7 +1177,7 @@ public void sendEditMessage(){ |
1176 | 1177 | try { |
1177 | 1178 | CountDownLatch countDownLatch = new CountDownLatch(1); |
1178 | 1179 |
|
1179 | | - TextMessage message = new TextMessage(UID, "text",CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER); |
| 1180 | + TextMessage message = new TextMessage(UID, "text", CometChatConstants.RECEIVER_TYPE_USER); |
1180 | 1181 | message.setId(MESSAGE_ID); |
1181 | 1182 |
|
1182 | 1183 | CometChat.editMessage(message, new CometChat.CallbackListener<BaseMessage>() { |
@@ -1210,7 +1211,7 @@ public void sendEditTextMessageWithImageType(){ |
1210 | 1211 | try { |
1211 | 1212 | CountDownLatch countDownLatch = new CountDownLatch(1); |
1212 | 1213 |
|
1213 | | - TextMessage message = new TextMessage(UID, "Hey", CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER); |
| 1214 | + TextMessage message = new TextMessage(UID, "Hey", CometChatConstants.RECEIVER_TYPE_USER); |
1214 | 1215 | message.setId(398); |
1215 | 1216 |
|
1216 | 1217 | CometChat.editMessage(message, new CometChat.CallbackListener<BaseMessage>() { |
@@ -1245,7 +1246,7 @@ public void sendEditMessageWithTypeGroup(){ |
1245 | 1246 | try { |
1246 | 1247 | CountDownLatch countDownLatch = new CountDownLatch(1); |
1247 | 1248 |
|
1248 | | - TextMessage message = new TextMessage(UID, "Edit text Message ", CometChatConstants.MESSAGE_TYPE_TEXT,CometChatConstants.RECEIVER_TYPE_GROUP); |
| 1249 | + TextMessage message = new TextMessage(UID, "Edit text Message ", CometChatConstants.RECEIVER_TYPE_GROUP); |
1249 | 1250 | message.setId(489); |
1250 | 1251 |
|
1251 | 1252 | CometChat.editMessage(message, new CometChat.CallbackListener<BaseMessage>() { |
@@ -1280,7 +1281,7 @@ public void sendEditMessageWithNull(){ |
1280 | 1281 | try { |
1281 | 1282 | CountDownLatch countDownLatch = new CountDownLatch(1); |
1282 | 1283 |
|
1283 | | - TextMessage message = new TextMessage(UID, null,CometChatConstants.MESSAGE_TYPE_TEXT, CometChatConstants.RECEIVER_TYPE_USER); |
| 1284 | + TextMessage message = new TextMessage(UID, null, CometChatConstants.RECEIVER_TYPE_USER); |
1284 | 1285 | message.setId(489); |
1285 | 1286 |
|
1286 | 1287 | CometChat.editMessage(message, new CometChat.CallbackListener<BaseMessage>() { |
@@ -1315,7 +1316,7 @@ public void sendEditMessageWithWrongId(){ |
1315 | 1316 | try { |
1316 | 1317 | CountDownLatch countDownLatch = new CountDownLatch(1); |
1317 | 1318 |
|
1318 | | - TextMessage message = new TextMessage(UID, "h",CometChatConstants.MESSAGE_TYPE_TEXT,CometChatConstants.RECEIVER_TYPE_USER); |
| 1319 | + TextMessage message = new TextMessage(UID, "h",CometChatConstants.RECEIVER_TYPE_USER); |
1319 | 1320 | message.setId(48); |
1320 | 1321 |
|
1321 | 1322 | CometChat.editMessage(message, new CometChat.CallbackListener<BaseMessage>() { |
@@ -1352,7 +1353,7 @@ public void sendEditMessageWithEmpty(){ |
1352 | 1353 | try { |
1353 | 1354 | CountDownLatch countDownLatch = new CountDownLatch(1); |
1354 | 1355 |
|
1355 | | - TextMessage message = new TextMessage(UID, "", CometChatConstants.MESSAGE_TYPE_TEXT,CometChatConstants.RECEIVER_TYPE_USER); |
| 1356 | + TextMessage message = new TextMessage(UID, "",CometChatConstants.RECEIVER_TYPE_USER); |
1356 | 1357 | message.setId(489); |
1357 | 1358 |
|
1358 | 1359 | CometChat.editMessage(message, new CometChat.CallbackListener<BaseMessage>() { |
@@ -3535,7 +3536,7 @@ public void test_GroupMemberRequestWithZeroLimit(){ |
3535 | 3536 | @Override |
3536 | 3537 | public void onSuccess(List<GroupMember> groupMembers) { |
3537 | 3538 | Log.d(TAG, "test_GroupMemberRequestWithZeroLimit onSuccess: "+groupMembers.size()); |
3538 | | - assertEquals(3,groupMembers.size()); |
| 3539 | + assertEquals(5,groupMembers.size()); |
3539 | 3540 | countDownLatch.countDown(); |
3540 | 3541 | } |
3541 | 3542 |
|
|
0 commit comments