1 // Tags: JDK1.4 |
|
2 |
|
3 // Copyright (C) 2005 Free Software Foundation, Inc. |
|
4 // Written by Tom Tromey <tromey@redhat.com> |
|
5 |
|
6 // This file is part of Mauve. |
|
7 |
|
8 // Mauve is free software; you can redistribute it and/or modify |
|
9 // it under the terms of the GNU General Public License as published by |
|
10 // the Free Software Foundation; either version 2, or (at your option) |
|
11 // any later version. |
|
12 |
|
13 // Mauve is distributed in the hope that it will be useful, |
|
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 // GNU General Public License for more details. |
|
17 |
|
18 // You should have received a copy of the GNU General Public License |
|
19 // along with Mauve; see the file COPYING. If not, write to |
|
20 // the Free Software Foundation, 59 Temple Place - Suite 330, |
|
21 // Boston, MA 02111-1307, USA. */ |
|
22 |
|
23 package gnu.testlet.java.io.File; |
|
24 |
|
25 import java.io.File; |
|
26 import java.net.URL; |
|
27 import java.net.MalformedURLException; |
|
28 |
|
29 import gnu.testlet.Testlet; |
|
30 import gnu.testlet.TestHarness; |
|
31 |
|
32 public class URI implements Testlet |
|
33 { |
|
34 public void check (TestHarness harness, URL url) |
|
35 { |
|
36 harness.check(url.getProtocol(), "file"); |
|
37 harness.check(url.getFile(), "/tmp/maude"); |
|
38 } |
|
39 |
|
40 public void test (TestHarness harness) |
|
41 { |
|
42 File f = new File("/tmp/maude"); |
|
43 harness.checkPoint("toURL"); |
|
44 try |
|
45 { |
|
46 check(harness, f.toURL()); |
|
47 } |
|
48 catch (MalformedURLException _) |
|
49 { |
|
50 harness.check(false); |
|
51 } |
|
52 |
|
53 harness.checkPoint("toURI"); |
|
54 try |
|
55 { |
|
56 check(harness, f.toURI().toURL()); |
|
57 } |
|
58 catch (MalformedURLException _) |
|
59 { |
|
60 harness.check(false); |
|
61 } |
|
62 } |
|
63 } |
|