file writter with its tests