1 // Tags: JDK1.4 |
|
2 |
|
3 /* |
|
4 Copyright (C) 2005 Andrew John Hughes (gnu_andrew@member.fsf.org) |
|
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 |
|
24 package gnu.testlet.java.net.URI; |
|
25 |
|
26 import gnu.testlet.Testlet; |
|
27 import gnu.testlet.TestHarness; |
|
28 |
|
29 import java.net.URI; |
|
30 import java.net.URISyntaxException; |
|
31 |
|
32 public class ToASCIIStringTest |
|
33 implements Testlet |
|
34 { |
|
35 |
|
36 private static final String TEST_URI_1 = "http://example.com/money/\uFFE5/file.html"; |
|
37 |
|
38 public void test(TestHarness h) |
|
39 { |
|
40 try |
|
41 { |
|
42 h.check(new URI(TEST_URI_1).toString(), TEST_URI_1); |
|
43 h.check(new URI(TEST_URI_1).toASCIIString(), "http://example.com/money/%EF%BF%A5/file.html"); |
|
44 } |
|
45 catch (URISyntaxException e) |
|
46 { |
|
47 h.debug(e); |
|
48 h.fail("Unexpected exception"); |
|
49 } |
|
50 } |
|
51 } |
|