Extracted method from test to create directory and throw IOException if it can't be created