KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > tidy > EncodingNameMapperTest


1 /*
2  * Java HTML Tidy - JTidy
3  * HTML parser and pretty printer
4  *
5  * Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts
6  * Institute of Technology, Institut National de Recherche en
7  * Informatique et en Automatique, Keio University). All Rights
8  * Reserved.
9  *
10  * Contributing Author(s):
11  *
12  * Dave Raggett <dsr@w3.org>
13  * Andy Quick <ac.quick@sympatico.ca> (translation to Java)
14  * Gary L Peskin <garyp@firstech.com> (Java development)
15  * Sami Lempinen <sami@lempinen.net> (release management)
16  * Fabrizio Giustina <fgiust at users.sourceforge.net>
17  *
18  * The contributing author(s) would like to thank all those who
19  * helped with testing, bug fixes, and patience. This wouldn't
20  * have been possible without all of you.
21  *
22  * COPYRIGHT NOTICE:
23  *
24  * This software and documentation is provided "as is," and
25  * the copyright holders and contributing author(s) make no
26  * representations or warranties, express or implied, including
27  * but not limited to, warranties of merchantability or fitness
28  * for any particular purpose or that the use of the software or
29  * documentation will not infringe any third party patents,
30  * copyrights, trademarks or other rights.
31  *
32  * The copyright holders and contributing author(s) will not be
33  * liable for any direct, indirect, special or consequential damages
34  * arising out of any use of the software or documentation, even if
35  * advised of the possibility of such damage.
36  *
37  * Permission is hereby granted to use, copy, modify, and distribute
38  * this source code, or portions hereof, documentation and executables,
39  * for any purpose, without fee, subject to the following restrictions:
40  *
41  * 1. The origin of this source code must not be misrepresented.
42  * 2. Altered versions must be plainly marked as such and must
43  * not be misrepresented as being the original source.
44  * 3. This Copyright notice may not be removed or altered from any
45  * source or altered source distribution.
46  *
47  * The copyright holders and contributing author(s) specifically
48  * permit, without fee, and encourage the use of this source code
49  * as a component for supporting the Hypertext Markup Language in
50  * commercial products. If you use this source code in a product,
51  * acknowledgment is not required but would be appreciated.
52  *
53  */

54 package org.w3c.tidy;
55
56 import junit.framework.TestCase;
57
58
59 /**
60  * Test cases for EncodingNameMapper.
61  * @author Fabrizio Giustina
62  * @version $Revision $ ($Author $)
63  */

64 public class EncodingNameMapperTest extends TestCase
65 {
66
67     /**
68      * instantiates a new test.
69      * @param name test name
70      */

71     public EncodingNameMapperTest(String JavaDoc name)
72     {
73         super(name);
74     }
75
76     /**
77      * Test for toJava().
78      */

79     public void testToJava()
80     {
81         assertEquals("UTF8", EncodingNameMapper.toJava("utf8"));
82         assertEquals("UTF8", EncodingNameMapper.toJava("UTF-8"));
83         assertEquals("ASCII", EncodingNameMapper.toJava("US-ASCII"));
84         assertEquals("ASCII", EncodingNameMapper.toJava("ASCII"));
85         assertEquals("ISO8859_1", EncodingNameMapper.toJava("LATIN1"));
86         assertEquals("ISO8859_1", EncodingNameMapper.toJava("ISO-8859-1"));
87         assertEquals("Cp1252", EncodingNameMapper.toJava("WINDOWS-1252"));
88         assertEquals("JIS", EncodingNameMapper.toJava("ISO2022"));
89         assertEquals("JIS", EncodingNameMapper.toJava("ISO-2022-JP"));
90         assertEquals("Big5", EncodingNameMapper.toJava("BIG5"));
91         assertEquals("Unicode", EncodingNameMapper.toJava("UTF16"));
92         assertEquals("UnicodeBig", EncodingNameMapper.toJava("UTF16BE"));
93         assertEquals("UnicodeLittle", EncodingNameMapper.toJava("UTF16LE"));
94         assertEquals("Unicode", EncodingNameMapper.toJava("UTF-16"));
95         assertEquals("UnicodeBig", EncodingNameMapper.toJava("UTF-16BE"));
96         assertEquals("UnicodeLittle", EncodingNameMapper.toJava("UTF-16LE"));
97         assertEquals("Cp858", EncodingNameMapper.toJava("CP858"));
98         assertEquals("Cp858", EncodingNameMapper.toJava("ibm858"));
99         assertEquals("MacRoman", EncodingNameMapper.toJava("Macintosh Roman"));
100         assertEquals("Cp1252", EncodingNameMapper.toJava("WiN1252"));
101         assertEquals("SJIS", EncodingNameMapper.toJava("SHIFTJIS"));
102         assertEquals(null, EncodingNameMapper.toJava("IBM-"));
103     }
104
105 }
Popular Tags