Skip to content

Commit 62ed9ad

Browse files
committed
Improve setWebhook test, lastErrorDate can be null sometimes
1 parent db496e2 commit 62ed9ad

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,14 @@ public void setWebhook() throws IOException {
989989
assertTrue(webhookInfo.hasCustomCertificate());
990990
assertEquals(maxConnections, webhookInfo.maxConnections());
991991
assertArrayEquals(allowedUpdates, webhookInfo.allowedUpdates());
992-
assertNotNull(webhookInfo.lastErrorDate());
992+
Integer lastErrorDate = webhookInfo.lastErrorDate();
993+
if (lastErrorDate != null) {
994+
assertEquals(System.currentTimeMillis(), lastErrorDate * 1000L, 30_000L);
995+
}
996+
String lastErrorMessage = webhookInfo.lastErrorMessage();
997+
if (lastErrorMessage != null) {
998+
assertTrue(lastErrorMessage.contains("SSL"));
999+
}
9931000
assertNotNull(webhookInfo.lastErrorMessage());
9941001
assertEquals(ipAddress, webhookInfo.ipAddress());
9951002
assertEquals(0, webhookInfo.pendingUpdateCount().intValue());

0 commit comments

Comments
 (0)