@Test public void sendDocument() { Message message = bot.execute(new SendDocument(chatId, docFileId)).message(); MessageTest.checkMessage(message); DocumentTest.check(message.document()); message = bot.execute(new SendDocument(chatId, docBytes).thumb(thumbBytes)).message(); MessageTest.checkMessage(message); DocumentTest.check(message.document()); assertEquals(thumbSize, message.document().thumb().fileSize()); String caption = "caption <b>bold</b>", fileName = "my doc.zip"; ParseMode parseMode = ParseMode.HTML; message = bot.execute( new SendDocument(chatId, docFile).fileName(fileName).thumb(thumbFile).caption(caption).parseMode(parseMode)) .message(); MessageTest.checkMessage(message); DocumentTest.check(message.document()); assertEquals(caption.replace("<b>", "").replace("</b>", ""), message.caption()); assertEquals(fileName, message.document().fileName()); assertEquals(thumbSize, message.document().thumb().fileSize()); MessageEntity captionEntity = message.captionEntities()[0]; assertEquals(MessageEntity.Type.bold, captionEntity.type()); assertEquals((Integer) 8, captionEntity.offset()); assertEquals((Integer) 4, captionEntity.length()); }
public <T extends BaseRequest<T, R>, R extends BaseResponse> R execute(BaseRequest<T, R> request) { return api.send(request); }
TelegramBot { public <T extends BaseRequest<T, R>, R extends BaseResponse> R execute(BaseRequest<T, R> request) { return api.send(request); } }
TelegramBot { public <T extends BaseRequest<T, R>, R extends BaseResponse> R execute(BaseRequest<T, R> request) { return api.send(request); } TelegramBot(String botToken);   TelegramBot(Builder builder); }
TelegramBot { public <T extends BaseRequest<T, R>, R extends BaseResponse> R execute(BaseRequest<T, R> request) { return api.send(request); } TelegramBot(String botToken);   TelegramBot(Builder builder); R execute(BaseRequest<T, R> request); void execute(T request, Callback<T, R> callback); String getFullFilePath(File file); byte[] getFileContent(File file); void setUpdatesListener(UpdatesListener listener); void setUpdatesListener(UpdatesListener listener, GetUpdates request); void setUpdatesListener(UpdatesListener listener, ExceptionHandler exceptionHandler); void setUpdatesListener(UpdatesListener listener, ExceptionHandler exceptionHandler, GetUpdates request); void removeGetUpdatesListener(); }
TelegramBot { public <T extends BaseRequest<T, R>, R extends BaseResponse> R execute(BaseRequest<T, R> request) { return api.send(request); } TelegramBot(String botToken);   TelegramBot(Builder builder); R execute(BaseRequest<T, R> request); void execute(T request, Callback<T, R> callback); String getFullFilePath(File file); byte[] getFileContent(File file); void setUpdatesListener(UpdatesListener listener); void setUpdatesListener(UpdatesListener listener, GetUpdates request); void setUpdatesListener(UpdatesListener listener, ExceptionHandler exceptionHandler); void setUpdatesListener(UpdatesListener listener, ExceptionHandler exceptionHandler, GetUpdates request); void removeGetUpdatesListener();  }