public <T extends Serializable, Method extends BotApiMethod<T>> Optional<T> execute(Method method) {
    try {
      return Optional.ofNullable(telegramClient.execute(method));
    } catch (TelegramApiException e) {
      log.error("Could not execute bot API method", e);
      return Optional.empty();
    }
  }
@Test
  void returnsEmptyOnError() throws TelegramApiException {
    when(telegramClient.execute(isNull(BotApiMethod.class))).thenThrow(TelegramApiException.class);

    Optional<Serializable> execute = silent.execute(null);

    assertFalse(execute.isPresent(), "Execution of a bot API method with execption results in a nonempty optional");
  }