2018-07-08 01:41:21 +02:00
|
|
|
package org.telegram.telegrambots.meta.test;
|
2016-12-26 03:46:46 +01:00
|
|
|
|
2020-11-03 03:57:36 +01:00
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
2019-07-08 21:22:51 +02:00
|
|
|
import org.junit.jupiter.api.Test;
|
2018-07-08 01:41:21 +02:00
|
|
|
import org.telegram.telegrambots.meta.TelegramBotsApi;
|
2020-11-03 03:57:36 +01:00
|
|
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
|
|
|
|
import org.telegram.telegrambots.meta.generics.BotSession;
|
|
|
|
import org.telegram.telegrambots.meta.generics.Webhook;
|
2019-07-08 21:22:51 +02:00
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.fail;
|
2020-11-03 03:57:36 +01:00
|
|
|
import static org.mockito.Mockito.mock;
|
2016-12-26 03:46:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Ruben Bermudez
|
|
|
|
* @version 1.0
|
|
|
|
*/
|
2020-11-03 03:57:36 +01:00
|
|
|
class TestTelegramApi {
|
2016-12-26 03:46:46 +01:00
|
|
|
|
2020-11-03 03:57:36 +01:00
|
|
|
private Webhook webhook;
|
2016-12-26 03:46:46 +01:00
|
|
|
|
2020-11-03 03:57:36 +01:00
|
|
|
@BeforeEach
|
|
|
|
public void setUp() {
|
|
|
|
webhook = mock(Webhook.class);
|
2016-12-26 03:46:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2020-11-03 03:57:36 +01:00
|
|
|
void TestTelegramApiMustBeInitializableForLongPolling() {
|
2016-12-26 03:46:46 +01:00
|
|
|
try {
|
2020-11-03 03:57:36 +01:00
|
|
|
new TelegramBotsApi(BotSession.class);
|
|
|
|
} catch (TelegramApiException e) {
|
2019-07-08 21:22:51 +02:00
|
|
|
fail();
|
2016-12-26 03:46:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2020-11-03 03:57:36 +01:00
|
|
|
void TestTelegramApiMustBeInitializableForWebhook() {
|
2016-12-26 03:46:46 +01:00
|
|
|
try {
|
2020-11-03 03:57:36 +01:00
|
|
|
new TelegramBotsApi(BotSession.class, webhook);
|
|
|
|
} catch (TelegramApiException e) {
|
2019-07-08 21:22:51 +02:00
|
|
|
fail();
|
2016-12-26 03:46:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|