Modify createDirectory() and write all of its test cases.