本文整理汇总了Java中org.telegram.abilitybots.api.objects.EndUser类的典型用法代码示例。如果您正苦于以下问题:Java EndUser类的具体用法?Java EndUser怎么用?Java EndUser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EndUser类属于org.telegram.abilitybots.api.objects包,在下文中一共展示了EndUser类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canRecoverDB
import org.telegram.abilitybots.api.objects.EndUser; //导入依赖的package包/类
@Test
public void canRecoverDB() throws IOException {
Map<Integer, EndUser> users = db.getMap(USERS);
Map<String, Integer> userIds = db.getMap(USER_ID);
users.put(CREATOR.id(), CREATOR);
users.put(MUSER.id(), MUSER);
userIds.put(CREATOR.username(), CREATOR.id());
userIds.put(MUSER.username(), MUSER.id());
db.getSet("AYRE").add(123123);
Map<Integer, EndUser> originalUsers = newHashMap(users);
String beforeBackupInfo = db.info(USERS);
Object jsonBackup = db.backup();
db.clear();
boolean recovered = db.recover(jsonBackup);
Map<Integer, EndUser> recoveredUsers = db.getMap(USERS);
String afterRecoveryInfo = db.info(USERS);
assertTrue("Could not recover database successfully", recovered);
assertEquals("Map info before and after recovery is different", beforeBackupInfo, afterRecoveryInfo);
assertEquals("Map before and after recovery are not equal", originalUsers, recoveredUsers);
}
示例2: canFallbackDBIfRecoveryFails
import org.telegram.abilitybots.api.objects.EndUser; //导入依赖的package包/类
@Test
public void canFallbackDBIfRecoveryFails() throws IOException {
Set<EndUser> users = db.getSet(USERS);
users.add(CREATOR);
users.add(MUSER);
Set<EndUser> originalSet = newHashSet(users);
Object jsonBackup = db.backup();
String corruptBackup = "[email protected]#$" + String.valueOf(jsonBackup);
boolean recovered = db.recover(corruptBackup);
Set<EndUser> recoveredSet = db.getSet(USERS);
assertEquals("Recovery was successful from a CORRUPT backup", false, recovered);
assertEquals("Set before and after corrupt recovery are not equal", originalSet, recoveredSet);
}
示例3: canSayHelloWorld
import org.telegram.abilitybots.api.objects.EndUser; //导入依赖的package包/类
@Test
public void canSayHelloWorld() {
Update mockedUpdate = mock(Update.class);
EndUser endUser = EndUser.endUser(USER_ID, "Abbas", "Abou Daya", "addo37");
MessageContext context = MessageContext.newContext(mockedUpdate, endUser, CHAT_ID);
bot.saysHelloWorld().action().accept(context);
// We verify that the sender was called only ONCE and sent Hello World to CHAT_ID
Mockito.verify(sender, times(1)).send("Hello World!", CHAT_ID);
}