當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。