當前位置: 首頁>>代碼示例>>Java>>正文


Java MessagingItem.setPostback方法代碼示例

本文整理匯總了Java中com.restfb.types.webhook.messaging.MessagingItem.setPostback方法的典型用法代碼示例。如果您正苦於以下問題:Java MessagingItem.setPostback方法的具體用法?Java MessagingItem.setPostback怎麽用?Java MessagingItem.setPostback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.restfb.types.webhook.messaging.MessagingItem的用法示例。


在下文中一共展示了MessagingItem.setPostback方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testOnPostback

import com.restfb.types.webhook.messaging.MessagingItem; //導入方法依賴的package包/類
@Test
public void testOnPostback() {
    PostbackItem postback = new PostbackItem();
    MessagingItem messagingItem = new MessagingItem();
    messagingItem.setPostback(postback);
    WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
    spyCallbackHandler.onCallback(messenger, webhookObject);
    verify(spyCallbackHandler, times(1)).onPostback(messenger, messagingItem);
    verifyNoMoreInteractions(spyCallbackHandler);
}
 
開發者ID:marsbits,項目名稱:restfbmessenger,代碼行數:11,代碼來源:AbstractCallbackHandlerTests.java

示例2: testMultipleMessagingItems

import com.restfb.types.webhook.messaging.MessagingItem; //導入方法依賴的package包/類
@Test
public void testMultipleMessagingItems() {
    MessageItem message1 = new MessageItem();
    MessagingItem messagingItem1 = new MessagingItem();
    messagingItem1.setMessage(message1);
    MessageItem message2 = new MessageItem();
    MessagingItem messagingItem2 = new MessagingItem();
    messagingItem2.setMessage(message2);
    PostbackItem postback = new PostbackItem();
    MessagingItem messagingItem3 = new MessagingItem();
    messagingItem3.setPostback(postback);
    MessagingItem messagingItem4 = new MessagingItem();
    MessageItem standby1 = new MessageItem();
    MessagingItem standbyItem1 = new MessagingItem();
    standbyItem1.setMessage(standby1);
    MessageItem standby2 = new MessageItem();
    MessagingItem standbyItem2 = new MessagingItem();
    standbyItem2.setMessage(standby2);
    MessagingItem standbyItem3 = new MessagingItem();
    WebhookObject webhookObject = createWebhookObject(
            Arrays.asList(messagingItem1, messagingItem2, messagingItem3, messagingItem4),
            Arrays.asList(standbyItem1, standbyItem2, standbyItem3));
    spyCallbackHandler.onCallback(messenger, webhookObject);
    verify(spyCallbackHandler, times(1)).onMessage(messenger, messagingItem1);
    verify(spyCallbackHandler, times(1)).onMessage(messenger, messagingItem2);
    verify(spyCallbackHandler, times(1)).onPostback(messenger, messagingItem3);
    verify(spyCallbackHandler, times(1)).fallback(messenger, messagingItem4);
    verify(spyCallbackHandler, times(1)).onStandbyMessage(messenger, standbyItem1);
    verify(spyCallbackHandler, times(1)).onStandbyMessage(messenger, standbyItem2);
    verify(spyCallbackHandler, times(1)).standbyFallback(messenger, standbyItem3);
    verifyNoMoreInteractions(spyCallbackHandler);
}
 
開發者ID:marsbits,項目名稱:restfbmessenger,代碼行數:33,代碼來源:AbstractCallbackHandlerTests.java


注:本文中的com.restfb.types.webhook.messaging.MessagingItem.setPostback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。