You do forget to add an extension to the filename. And the name is in both screenshots only Testfile. So the download is correct. Try setting the file name to something with .pdf behind it.
You are uploading a document sample.pdf but you rename that file to Testfile and it seems you are changing it again when dowloading to .Testfile Why? If you decide to change the name of the filedocument attribute atleast make sure that it is in the format name.extension.
in file name extension is already there,