How will you find count of each word in a file. Write code and test cases.