1 /* 2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @summary <rdar://problem/2297115> File.mkdir() fails to make new folders 27 * @summary com.apple.junit.java.io.File 28 * @run junit R2297115File_mkdir 29 */ 30 31 import junit.framework.*; 32 import java.io.File; 33 34 public class R2297115File_mkdir extends TestCase { 35 public static Test suite() { 36 return new TestSuite(R2297115File_mkdir.class); 37 } 38 39 public static void main(String argv[]) { 40 junit.textui.TestRunner.run(suite()); 41 } 42 43 public void testR2297115() { 44 String FS = System.getProperty("file.separator"); 45 String tmp = System.getProperty("java.io.tmpdir"); 46 47 File newFolder2 = new File(tmp + FS, "mySubFolder2" + FS); 48 if( newFolder2.exists() ) { 49 newFolder2.delete(); 50 } 51 52 newFolder2.mkdir(); 53 assertTrue( newFolder2.exists() ); 54 newFolder2.delete(); 55 56 File newFolder1 = new File(tmp + FS, "mySubFolder1"); 57 if( newFolder1.exists() ) { 58 newFolder1.delete(); 59 } 60 61 newFolder1.mkdir(); 62 assertTrue( newFolder1.exists() ); 63 newFolder1.delete(); 64 } 65 }