当前位置: 首页>>代码示例>>Java>>正文


Java EndUser类代码示例

本文整理汇总了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);
}
 
开发者ID:addo37,项目名称:AbilityBots,代码行数:25,代码来源:MapDBContextTest.java

示例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);
}
 
开发者ID:addo37,项目名称:AbilityBots,代码行数:17,代码来源:MapDBContextTest.java

示例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);
}
 
开发者ID:addo37,项目名称:ExampleBots,代码行数:12,代码来源:ExampleBotTest.java


注:本文中的org.telegram.abilitybots.api.objects.EndUser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。