IOException change in testmethod and code