Closed damorosodaragona closed 6 years ago
Why do you extend TelegramLongPollingCommandBot
and implement LongPollingBot
? You only need to extend TelegramLongPollingCommandBot.
The easiest way would be to create instances of Update, fill it it that it fits your needs(chat id, message text, etc.) and then pass it to onUpdateReceived
1) you are right! Since know i have used old api, and with old api you must extends TelegramLongPollingBot and implements LonPollingBot. 2) I have try to do it, but when you create an istance of update you can't set the message or the chatID or anything else.
I don't think so. When I remember correctly it was never needed to implement something like LongPollingCommandbot
. I also double checked it it as I tried to search for something like that in the old Tutorials and examples. Could you please provide me a link for that kind of information?
I will try to make you an example
test(){ Update update = new Update(); }
but i can't understand how set the fields which i need, because i find only getMethods on update object.Hi @damorosodaragona , have a look at those tests: https://github.com/rubenlagus/TelegramBots/blob/master/telegrambots/src/test/java/org/telegram/telegrambots/test/TestRestApi.java
Hi, i have a class MyBot that extends TelegramLongPollingCommandBot implements LongPollingBot, know i want write test, i have try with Mockito but i can't understand to use it for testing the bot. I have find an example test class here https://github.com/addo37/ExampleBots/blob/master/src/test/java/org/telegram/examplebots/ExampleBotTest.java but it work only if i use AbilityBot API, there is a way to do this without using that API?