BlobUtils { static File initLocalStorageDirectory(String basePath) throws IOException { File baseDir; if (StringUtils.isNullOrWhitespaceOnly(basePath)) { baseDir = new File(System.getProperty("java.io.tmpdir")); } else { baseDir = new File(basePath); } File storageDir; final int MAX_ATTEMPTS = 10; for(int attempt = 0; attempt < MAX_ATTEMPTS; attempt++) { storageDir = new File(baseDir, String.format( "blobStore-%s", UUID.randomUUID().toString())); if (storageDir.mkdirs()) { return storageDir; } } throw new IOException("Could not create storage directory for BLOB store in '" + baseDir + "'."); } private  BlobUtils(); static BlobStoreService createBlobStoreFromConfig(Configuration config);  }
@Test(expected = IOException.class) public void testExceptionOnCreateStorageDirectoryFailure() throws IOException { BlobUtils.initLocalStorageDirectory(new File(blobUtilsTestDirectory, CANNOT_CREATE_THIS).getAbsolutePath()); }