Add testing telegram for java and tests in kotlin

This commit is contained in:
Sambo Chea 2021-05-24 20:22:36 +07:00
parent 28b4988e6f
commit 31d68fbdbb
3 changed files with 21 additions and 0 deletions

View File

@ -24,6 +24,7 @@ class TelegramProvider : MessageProvider, Loggable {
this._chatId = chatId this._chatId = chatId
} }
@JvmOverloads
fun setMessage(message: String, parseMode: TelegramParseMode? = null) = apply { fun setMessage(message: String, parseMode: TelegramParseMode? = null) = apply {
this._message = object : TelegramMessage { this._message = object : TelegramMessage {
override fun getText(): String { override fun getText(): String {

View File

@ -47,4 +47,14 @@ public final class TelegramExampleJavaTests {
token token
); );
} }
@Test
public void sendMessageViaBuilder() {
String text = "Hello, Sambo with Provider!";
TelegramProvider
.init("")
.sendToChatId("")
.setMessage(text)
.send();
}
} }

View File

@ -77,4 +77,14 @@ class TelegramExampleKotlinTests {
.sendToChatId(chatId) .sendToChatId(chatId)
.send() .send()
} }
@Test
fun sendTextViaBuilder() {
val text = "*Hello World* from Provider with MARKDOWN parse mode!"
TelegramProvider
.init("")
.sendToChatId("")
.setMessage(text)
.send()
}
} }