You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2018/05/09 08:51:00 UTC
[camel] 01/06: Test to cover custom keyboard
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit a16fedc58d511187a31ec1e89e8902eebe369116
Author: Willian Antunes <wi...@gmail.com>
AuthorDate: Tue May 1 16:16:58 2018 -0700
Test to cover custom keyboard
---
.../telegram/integration/TelegramServiceTest.java | 40 ++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/integration/TelegramServiceTest.java b/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/integration/TelegramServiceTest.java
index 9209cb5..4afbdb0 100644
--- a/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/integration/TelegramServiceTest.java
+++ b/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/integration/TelegramServiceTest.java
@@ -17,15 +17,18 @@
package org.apache.camel.component.telegram.integration;
import java.io.IOException;
+import java.util.Arrays;
import org.apache.camel.component.telegram.TelegramParseMode;
import org.apache.camel.component.telegram.TelegramService;
import org.apache.camel.component.telegram.TelegramServiceProvider;
+import org.apache.camel.component.telegram.model.InlineKeyboardButton;
import org.apache.camel.component.telegram.model.OutgoingAudioMessage;
import org.apache.camel.component.telegram.model.OutgoingDocumentMessage;
import org.apache.camel.component.telegram.model.OutgoingPhotoMessage;
import org.apache.camel.component.telegram.model.OutgoingTextMessage;
import org.apache.camel.component.telegram.model.OutgoingVideoMessage;
+import org.apache.camel.component.telegram.model.ReplyKeyboardMarkup;
import org.apache.camel.component.telegram.model.UpdateResult;
import org.apache.camel.component.telegram.util.TelegramTestUtil;
import org.junit.Assert;
@@ -91,6 +94,43 @@ public class TelegramServiceTest {
service.sendMessage(authorizationToken, msg);
}
+
+ @Test
+ public void testSendMessageWithKeyboard() {
+ TelegramService service = TelegramServiceProvider.get().getService();
+
+ OutgoingTextMessage msg = new OutgoingTextMessage();
+ msg.setChatId(chatId);
+ msg.setText("Choose one option!");
+
+ InlineKeyboardButton buttonOptionOneI = InlineKeyboardButton.builder()
+ .text("Option One - I").build();
+
+ InlineKeyboardButton buttonOptionOneII = InlineKeyboardButton.builder()
+ .text("Option One - II").build();
+
+ InlineKeyboardButton buttonOptionTwoI = InlineKeyboardButton.builder()
+ .text("Option Two - I").build();
+
+ InlineKeyboardButton buttonOptionThreeI = InlineKeyboardButton.builder()
+ .text("Option Three - I").build();
+
+ InlineKeyboardButton buttonOptionThreeII = InlineKeyboardButton.builder()
+ .text("Option Three - II").build();
+
+ ReplyKeyboardMarkup replyMarkup = ReplyKeyboardMarkup.builder()
+ .keyboard()
+ .addRow(Arrays.asList(buttonOptionOneI, buttonOptionOneII))
+ .addRow(Arrays.asList(buttonOptionTwoI))
+ .addRow(Arrays.asList(buttonOptionThreeI, buttonOptionThreeII))
+ .close()
+ .oneTimeKeyboard(true)
+ .build();
+
+ msg.setReplyKeyboardMarkup(replyMarkup);
+
+ service.sendMessage(authorizationToken, msg);
+ }
@Test
public void testSendFull() {
--
To stop receiving notification emails like this one, please contact
acosentino@apache.org.