1) Move this to FileUtils
2) change it: writeStringToFile(Path path, String stringToWrite)

This way it's general, and you may reuse it. If I'm not mistaken, you used such a behavior in the tests?