I have a question about unit testing. I thought about this for several days and could not find the answer.
Let's say I have a function that downloads files from a web service and writes it to disk. What is the purpose of testing it without actually viewing files downloaded and written to disk?
Although I understand that we can mock a web service, but how can I do this in this scenario? As far as I know, something like Mockito only mocks behavior, but does not provide meaningful data (file in this example).
Even if we can scoff at the behavior of a web service, how can I scoff at writing a file to disk without writing anything to disk?
Sorry, I do not have a specific example for this. Please feel free to give your opinion.
Many thanks
Kevin source
share