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


Java MessagingItem.setMessage方法代码示例

本文整理汇总了Java中com.restfb.types.webhook.messaging.MessagingItem.setMessage方法的典型用法代码示例。如果您正苦于以下问题:Java MessagingItem.setMessage方法的具体用法?Java MessagingItem.setMessage怎么用?Java MessagingItem.setMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.restfb.types.webhook.messaging.MessagingItem的用法示例。


在下文中一共展示了MessagingItem.setMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testOnMessage

import com.restfb.types.webhook.messaging.MessagingItem; //导入方法依赖的package包/类
@Test
public void testOnMessage() {
    MessageItem message = new MessageItem();
    MessagingItem messagingItem = new MessagingItem();
    messagingItem.setMessage(message);
    WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
    spyCallbackHandler.onCallback(messenger, webhookObject);
    verify(spyCallbackHandler, times(1)).onMessage(messenger, messagingItem);
    verifyNoMoreInteractions(spyCallbackHandler);
}
 
开发者ID:marsbits,项目名称:restfbmessenger,代码行数:11,代码来源:AbstractCallbackHandlerTests.java

示例2: testOnMessageEcho

import com.restfb.types.webhook.messaging.MessagingItem; //导入方法依赖的package包/类
@Test
public void testOnMessageEcho() {
    MessageItem message = new MessageItem();
    message.setEcho(true);
    MessagingItem messagingItem = new MessagingItem();
    messagingItem.setMessage(message);
    WebhookObject webhookObject = createWebhookObjectWithMessagingItem(messagingItem);
    spyCallbackHandler.onCallback(messenger, webhookObject);
    verify(spyCallbackHandler, times(1)).onMessageEcho(messenger, messagingItem);
    verifyNoMoreInteractions(spyCallbackHandler);
}
 
开发者ID:marsbits,项目名称:restfbmessenger,代码行数:12,代码来源:AbstractCallbackHandlerTests.java

示例3: testOnStandbyMessage

import com.restfb.types.webhook.messaging.MessagingItem; //导入方法依赖的package包/类
@Test
public void testOnStandbyMessage() {
    MessageItem message = new MessageItem();
    MessagingItem standbyItem = new MessagingItem();
    standbyItem.setMessage(message);
    WebhookObject webhookObject = createWebhookObjectWithStandbyItem(standbyItem);
    spyCallbackHandler.onCallback(messenger, webhookObject);
    verify(spyCallbackHandler, times(1)).onStandbyMessage(messenger, standbyItem);
    verifyNoMoreInteractions(spyCallbackHandler);
}
 
开发者ID:marsbits,项目名称:restfbmessenger,代码行数:11,代码来源:AbstractCallbackHandlerTests.java

示例4: testOnStandbyMessageEcho

import com.restfb.types.webhook.messaging.MessagingItem; //导入方法依赖的package包/类
@Test
public void testOnStandbyMessageEcho() {
    MessageItem message = new MessageItem();
    message.setEcho(true);
    MessagingItem standbyItem = new MessagingItem();
    standbyItem.setMessage(message);
    WebhookObject webhookObject = createWebhookObjectWithStandbyItem(standbyItem);
    spyCallbackHandler.onCallback(messenger, webhookObject);
    verify(spyCallbackHandler, times(1)).onStandbyMessageEcho(messenger, standbyItem);
    verifyNoMoreInteractions(spyCallbackHandler);
}
 
开发者ID:marsbits,项目名称:restfbmessenger,代码行数:12,代码来源:AbstractCallbackHandlerTests.java

示例5: 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

示例6: testLocationMessage

import com.restfb.types.webhook.messaging.MessagingItem; //导入方法依赖的package包/类
@Test
public void testLocationMessage() {
	final MessagingParticipant recipient = new MessagingParticipant();
	recipient.setId("recipientId");

	final MessagingParticipant sender = new MessagingParticipant();
	sender.setId("senderId");

	final double longVal = 4.5555525555;
	final double latVal = 6.23342;

	final CoordinatesItem coordinatesItem = new CoordinatesItem();
	coordinatesItem.setLongVal(longVal);
	coordinatesItem.setLat(latVal);

	final MessagingPayload messagingPayload = new MessagingPayload();
	messagingPayload.setCoordinates(coordinatesItem);

	final MessagingAttachment messagingAttachment = new MessagingAttachment();
	messagingAttachment.setPayload(messagingPayload);
	messagingAttachment.setType("location");

	final ArrayList<MessagingAttachment> list = new ArrayList<>();
	list.add(messagingAttachment);

	final MessageItem messageItem = new MessageItem();
	messageItem.setAttachments(list);

	final MessagingItem messagingItem = new MessagingItem();
	messagingItem.setMessage(messageItem);
	messagingItem.setRecipient(recipient);
	messagingItem.setSender(sender);

	final ReceiveMessage receiveMessage = facebookReceiveMessageFactory.createReceiveMessage(messagingItem, null);

	for (final AbstractReceivePayload payload : receiveMessage.getPayloads()) {
		final CoordinateReceivePayload coordinations = (CoordinateReceivePayload) payload;
		assertEquals(latVal, coordinations.getLatVal(), epsilon);
		assertEquals(longVal, coordinations.getLonVal(), epsilon);
	}
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:42,代码来源:FacebookMessageTest.java


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