1 /* ExecuteMethods.java -- Test File execute methods of classpath 1.6 |
|
2 Copyright (C) 2007 Mario Torre <neugens@limasoftware.net> |
|
3 This file is part of Mauve. |
|
4 |
|
5 Mauve is free software; you can redistribute it and/or modify |
|
6 it under the terms of the GNU General Public License as published by |
|
7 the Free Software Foundation; either version 2, or (at your option) |
|
8 any later version. |
|
9 |
|
10 Mauve is distributed in the hope that it will be useful, but |
|
11 WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU General Public License |
|
16 along with Mauve; see the file COPYING. If not, write to the |
|
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 02110-1301 USA. |
|
19 |
|
20 */ |
|
21 |
|
22 // Tags: JDK1.6 |
|
23 |
|
24 package gnu.testlet.java.io.File; |
|
25 |
|
26 import java.io.File; |
|
27 import java.io.IOException; |
|
28 |
|
29 import gnu.testlet.TestHarness; |
|
30 import gnu.testlet.Testlet; |
|
31 |
|
32 /** |
|
33 * Test file read methods of classpath 1.6 |
|
34 * |
|
35 * @author Mario Torre <neugens@limasoftware.net> |
|
36 */ |
|
37 public class ExecuteMethods |
|
38 implements Testlet |
|
39 { |
|
40 public void test(TestHarness harness) |
|
41 { |
|
42 String tmp = harness.getTempDirectory(); |
|
43 File tmpfile = new File(tmp, "mauve-testfile"); |
|
44 |
|
45 try |
|
46 { |
|
47 tmpfile.createNewFile(); |
|
48 } |
|
49 catch (IOException e) |
|
50 { |
|
51 harness.fail("cannot create file for test."); |
|
52 return; |
|
53 } |
|
54 |
|
55 boolean execute = tmpfile.canExecute(); |
|
56 |
|
57 // false because this file was just created |
|
58 harness.check(execute == false); |
|
59 |
|
60 execute = tmpfile.setExecutable(true); |
|
61 harness.check(execute == true); |
|
62 |
|
63 execute = tmpfile.canExecute(); |
|
64 harness.check(execute == true); |
|
65 |
|
66 tmpfile.delete(); |
|
67 } |
|
68 } |
|