/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.flink.runtime.blob;

import static org.mockito.Mockito.mock;

import org.junit.Test;

import java.io.File;

public class BlobUtilsTest {

	@Test(expected = Exception.class)
	public void testExceptionOnCreateStorageDirectoryFailure() {
		// Should throw an Exception
		BlobUtils.initStorageDirectory("/cannot-create-this");
	}

	@Test(expected = Exception.class)
	public void testExceptionOnCreateCacheDirectoryFailure() {
		// Should throw an Exception
		BlobUtils.getStorageLocation(new File("/cannot-create-this"), mock(BlobKey.class));
	}
}

@@ -892,75 +892,642 @@
 ort 
-org.junit.Test;%0A%0Aimport java.io.File;%0A%0Apublic class BlobUtilsTest %7B
+com.google.common.io.Files;%0A%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.io.File;%0A%0Apublic class BlobUtilsTest %7B%0A%0A%09private final static String CANNOT_CREATE_THIS = %22cannot-create-this%22;%0A%0A%09private File blobUtilsTestDirectory;%0A%0A%09@Before%0A%09public void before() %7B%0A%09%09// Prepare test directory%0A%09%09blobUtilsTestDirectory = Files.createTempDir();%0A%0A%09%09blobUtilsTestDirectory.setExecutable(true, false);%0A%09%09blobUtilsTestDirectory.setReadable(true, false);%0A%09%09blobUtilsTestDirectory.setWritable(false, false);%0A%09%7D%0A%0A%09@After%0A%09public void after() %7B%0A%09%09// Cleanup test directory%0A%09%09blobUtilsTestDirectory.delete();%0A%09%7D
 %0A%0A%09@
@@ -1685,37 +1685,86 @@
 rectory(
-%22/cannot-create-this%22
+new File(blobUtilsTestDirectory, CANNOT_CREATE_THIS).getAbsolutePath()
 );%0A%09%7D%0A%0A%09
@@ -1932,29 +1932,50 @@
 ile(
-%22/cannot-create-this%22
+blobUtilsTestDirectory, CANNOT_CREATE_THIS
 ), m

Test case at BlobUtilsTest should not assume user could not create new item in root directory