本文整理汇总了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);
}
示例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);
}