public SendDocument setDocument(File file) {
        Objects.requireNonNull(file, "documentName cannot be null!");
        this.document = new InputFile(file, file.getName());
        return this;
    }
public SendDocument setDocument ( File file ) { Objects . requireNonNull ( file , "documentName cannot be null!" ) ; this . document = new InputFile ( file , file . getName ( ) ) ; return this ; }
Use this method to set the document to a new file

@param file New document file