1 /* Resources.java -- Tests that the system class loader can get resources as |
|
2 plain file and directory |
|
3 Copyright (C) 2006 Olivier Jolly <olivier.jolly@pcedev.com> |
|
4 This file is part of Mauve. |
|
5 |
|
6 Mauve is free software; you can redistribute it and/or modify |
|
7 it under the terms of the GNU General Public License as published by |
|
8 the Free Software Foundation; either version 2, or (at your option) |
|
9 any later version. |
|
10 |
|
11 Mauve is distributed in the hope that it will be useful, but |
|
12 WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 General Public License for more details. |
|
15 |
|
16 You should have received a copy of the GNU General Public License |
|
17 along with Mauve; see the file COPYING. If not, write to the |
|
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
19 02110-1301 USA. |
|
20 |
|
21 */ |
|
22 |
|
23 // Tags: JDK1.0 |
|
24 |
|
25 |
|
26 package gnu.testlet.java.lang.ClassLoader; |
|
27 |
|
28 import gnu.testlet.TestHarness; |
|
29 import gnu.testlet.Testlet; |
|
30 |
|
31 /** |
|
32 * Tests which ensures that plain files and directories can be retrieved by the |
|
33 * system class loader. |
|
34 * @author Olivier Jolly <olivier.jolly@pcedev.com> |
|
35 * @see java.lang.ClassLoader#getResource(java.lang.String) |
|
36 */ |
|
37 public class Resources implements Testlet |
|
38 { |
|
39 |
|
40 public void test(TestHarness harness) |
|
41 { |
|
42 harness.checkPoint("Resource loading"); |
|
43 System.out.println(getClass().getClassLoader()); |
|
44 |
|
45 try |
|
46 { |
|
47 getClass().getClassLoader().getResource( |
|
48 "gnu/testlet/java/lang/ClassLoader/Resources.class").getFile(); |
|
49 harness.check(true); |
|
50 } |
|
51 catch (Exception e) |
|
52 { |
|
53 harness.fail("Class resource should exist"); |
|
54 } |
|
55 |
|
56 try |
|
57 { |
|
58 getClass().getClassLoader().getResource( |
|
59 "gnu/testlet/java/lang/ClassLoader/").getFile(); |
|
60 harness.check(true); |
|
61 } |
|
62 catch (Exception e) |
|
63 { |
|
64 harness.fail("Class directory should exist"); |
|
65 } |
|
66 |
|
67 try |
|
68 { |
|
69 getClass().getClassLoader().getResource( |
|
70 "gnu/testlet/java/lang/ClassLoader").getFile(); |
|
71 harness.check(true); |
|
72 } |
|
73 catch (Exception e) |
|
74 { |
|
75 harness.fail("Class directory should exist"); |
|
76 } |
|
77 |
|
78 } |
|
79 |
|
80 } |
|