This commit is contained in:
Ruben Bermudez 2021-04-16 01:25:39 +01:00
parent 528d5b8331
commit d7781f23e0
2 changed files with 44 additions and 1 deletions

View File

@ -87,7 +87,7 @@ public class Message implements BotApiObject {
private static final String VIABOT_FIELD = "via_bot"; private static final String VIABOT_FIELD = "via_bot";
private static final String SENDERCHAT_FIELD = "sender_chat"; private static final String SENDERCHAT_FIELD = "sender_chat";
private static final String PROXIMITYALERTTRIGGERED_FIELD = "proximity_alert_triggered"; private static final String PROXIMITYALERTTRIGGERED_FIELD = "proximity_alert_triggered";
private static final String MESSAGEAUTODELETETIMERCHANGED_FIELD = "message_auto_delete_timer_changed\t"; private static final String MESSAGEAUTODELETETIMERCHANGED_FIELD = "message_auto_delete_timer_changed";
private static final String VOICECHATSTARTED_FIELD = "voice_chat_started"; private static final String VOICECHATSTARTED_FIELD = "voice_chat_started";
private static final String VOICECHATENDED_FIELD = "voice_chat_ended"; private static final String VOICECHATENDED_FIELD = "voice_chat_ended";
private static final String VOICECHATPARTICIPANTSINVITED_FIELD = "voice_chat_participants_invited"; private static final String VOICECHATPARTICIPANTSINVITED_FIELD = "voice_chat_participants_invited";

View File

@ -343,6 +343,49 @@ class TestDeserialization {
assertTrue(response.getIsMember()); assertTrue(response.getIsMember());
} }
@Test
void TestDeserializationMessageAutodeleteChanged() throws Exception {
String updateText = "{\n" +
" \"ok\": true,\n" +
" \"result\": [\n" +
" {\n" +
" \"update_id\": 259894298,\n" +
" \"message\": {\n" +
" \"message_id\": 101,\n" +
" \"from\": {\n" +
" \"id\": 12345678,\n" +
" \"is_bot\": false,\n" +
" \"first_name\": \"FistName\",\n" +
" \"last_name\": \"LastName\",\n" +
" \"username\": \"username\"\n" +
" },\n" +
" \"chat\": {\n" +
" \"id\": 12345678,\n" +
" \"first_name\": \"FistName\",\n" +
" \"last_name\": \"LastName\",\n" +
" \"username\": \"username\",\n" +
" \"type\": \"private\"\n" +
" },\n" +
" \"date\": 1604171814,\n" +
" \"message_auto_delete_timer_changed\": {\n" +
" \"message_auto_delete_time\": 100\n" +
" }\n" +
" \n" +
" }\n" +
" }\n" +
" ]\n" +
"}";
ArrayList<Update> response = new GetUpdates().deserializeResponse(updateText);
assertNotNull(response);
assertEquals(1, response.size());
assertNotNull(response.get(0));
assertNotNull(response.get(0).getMessage());
assertNotNull(response.get(0).getMessage().getMessageAutoDeleteTimerChanged());
assertEquals(100, response.get(0).getMessage().getMessageAutoDeleteTimerChanged().getMessageAutoDeleteTime());
}
@Test @Test
void TestDeserializationLogoutMethod() throws Exception { void TestDeserializationLogoutMethod() throws Exception {
String updateText = "{\"ok\":true,\"result\": true}"; String updateText = "{\"ok\":true,\"result\": true}";