OSDN Git Service

release-1.503.4 タグをチェンジセット c16348cc4c65 に追加しました
[jindolf/JinArchiver.git] / src / test / java / jp / sourceforge / jindolf / archiver / XmlOutTest.java
1 /*
2  */
3
4 package jp.sourceforge.jindolf.archiver;
5
6 import java.io.StringWriter;
7 import java.io.Writer;
8 import jp.sourceforge.jindolf.parser.DecodeErrorInfo;
9 import jp.sourceforge.jindolf.parser.DecodedContent;
10 import org.junit.After;
11 import org.junit.AfterClass;
12 import org.junit.Before;
13 import org.junit.BeforeClass;
14 import org.junit.Test;
15
16 import static org.junit.Assert.*;
17
18 /**
19  *
20  */
21 public class XmlOutTest {
22
23     public XmlOutTest() {
24     }
25
26     @BeforeClass
27     public static void setUpClass() {
28     }
29
30     @AfterClass
31     public static void tearDownClass() {
32     }
33
34     @Before
35     public void setUp() {
36     }
37
38     @After
39     public void tearDown() {
40     }
41
42     /**
43      * Test of isWhiteSpace method, of class XmlUtils.
44      */
45     @Test
46     public void testIsWhiteSpace() {
47         System.out.println("isWhiteSpace");
48
49         assertTrue(XmlOut.isWhiteSpace('\u0020'));
50         assertTrue(XmlOut.isWhiteSpace('\t'));
51         assertTrue(XmlOut.isWhiteSpace('\n'));
52         assertTrue(XmlOut.isWhiteSpace('\r'));
53
54         assertFalse(XmlOut.isWhiteSpace('\u0000'));
55         assertFalse(XmlOut.isWhiteSpace('\u3000'));
56         assertFalse(XmlOut.isWhiteSpace('A'));
57         assertFalse(XmlOut.isWhiteSpace('亜'));
58
59         return;
60     }
61
62     /**
63      * Test of dumpDocType method, of class XmlUtils.
64      * @throws java.lang.Exception
65      */
66     @Test
67     public void testDumpDocType() throws Exception {
68         System.out.println("dumpDocType");
69         Writer writer;
70         XmlOut xmlOut;
71
72         writer = new StringWriter();
73         xmlOut = new XmlOut(writer);
74         xmlOut.dumpDocType();
75         xmlOut.close();
76
77         assertEquals("<!DOCTYPE village SYSTEM \"http://jindolf.sourceforge.jp/xml/dtd/bbsArchive-110421.dtd\" >", writer.toString());
78
79         return;
80     }
81
82     /**
83      * Test of dumpNameSpaceDecl method, of class XmlUtils.
84      * @throws java.lang.Exception
85      */
86     @Test
87     public void testDumpNameSpaceDecl() throws Exception {
88         System.out.println("dumpNameSpaceDecl");
89         Writer writer;
90         XmlOut xmlOut;
91
92         writer = new StringWriter();
93         xmlOut = new XmlOut(writer);
94         xmlOut.dumpNameSpaceDecl();
95         xmlOut.close();
96
97         assertEquals("xmlns=\"http://jindolf.sourceforge.jp/xml/ns/501\"", writer.toString());
98
99         return;
100     }
101
102     /**
103      * Test of dumpSiNameSpaceDecl method, of class XmlUtils.
104      * @throws java.lang.Exception
105      */
106     @Test
107     public void testDumpSiNameSpaceDecl() throws Exception {
108         System.out.println("dumpSiNameSpaceDecl");
109         Writer writer;
110         XmlOut xmlOut;
111
112         writer = new StringWriter();
113         xmlOut = new XmlOut(writer);
114         xmlOut.dumpSiNameSpaceDecl();
115         xmlOut.close();
116
117         assertEquals("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"", writer.toString());
118
119         return;
120     }
121
122     /**
123      * Test of dumpSchemeLocation method, of class XmlUtils.
124      * @throws java.lang.Exception
125      */
126     @Test
127     public void testDumpSchemeLocation() throws Exception {
128         System.out.println("dumpSchemeLocation");
129         Writer writer;
130         XmlOut xmlOut;
131
132         writer = new StringWriter();
133         xmlOut = new XmlOut(writer);
134         xmlOut.dumpSchemeLocation();
135         xmlOut.close();
136
137         assertEquals("xsi:schemaLocation=\"http://jindolf.sourceforge.jp/xml/ns/501 http://jindolf.sourceforge.jp/xml/xsd/bbsArchive-110421.xsd\"", writer.toString());
138
139         return;
140     }
141
142     /**
143      * Test of indent method, of class XmlUtils.
144      * @throws java.lang.Exception
145      */
146     @Test
147     public void testIndent() throws Exception {
148         System.out.println("indent");
149         Writer writer;
150         XmlOut xmlOut;
151
152         writer = new StringWriter();
153         xmlOut = new XmlOut(writer);
154         xmlOut.indent(1);
155         xmlOut.close();
156         assertEquals("  ", writer.toString());
157
158         writer = new StringWriter();
159         xmlOut = new XmlOut(writer);
160         xmlOut.indent(2);
161         xmlOut.close();
162         assertEquals("    ", writer.toString());
163
164         writer = new StringWriter();
165         xmlOut = new XmlOut(writer);
166         xmlOut.indent(0);
167         xmlOut.close();
168         assertEquals("", writer.toString());
169
170         return;
171     }
172
173     /**
174      * Test of charRefOut method, of class XmlUtils.
175      * @throws java.lang.Exception
176      */
177     @Test
178     public void testCharRefOut() throws Exception {
179         System.out.println("charRefOut");
180
181         Writer writer;
182         XmlOut xmlOut;
183
184         writer = new StringWriter();
185         xmlOut = new XmlOut(writer);
186         xmlOut.charRefOut('\u0020');
187         xmlOut.close();
188         assertEquals("&#x20;", writer.toString());
189
190         writer = new StringWriter();
191         xmlOut = new XmlOut(writer);
192         xmlOut.charRefOut('\u0009');
193         xmlOut.close();
194         assertEquals("&#x09;", writer.toString());
195
196         writer = new StringWriter();
197         xmlOut = new XmlOut(writer);
198         xmlOut.charRefOut('\u0000');
199         xmlOut.close();
200         assertEquals("&#x00;", writer.toString());
201
202         writer = new StringWriter();
203         xmlOut = new XmlOut(writer);
204         xmlOut.charRefOut('\u0001');
205         xmlOut.close();
206         assertEquals("&#x01;", writer.toString());
207
208         writer = new StringWriter();
209         xmlOut = new XmlOut(writer);
210         xmlOut.charRefOut('\u00ff');
211         xmlOut.close();
212         assertEquals("&#xff;", writer.toString());
213
214         writer = new StringWriter();
215         xmlOut = new XmlOut(writer);
216         xmlOut.charRefOut('\u0100');
217         xmlOut.close();
218         assertEquals("&#x0100;", writer.toString());
219
220         writer = new StringWriter();
221         xmlOut = new XmlOut(writer);
222         xmlOut.charRefOut('\u1000');
223         xmlOut.close();
224         assertEquals("&#x1000;", writer.toString());
225
226         writer = new StringWriter();
227         xmlOut = new XmlOut(writer);
228         xmlOut.charRefOut('\ud800');
229         xmlOut.close();
230         assertEquals("&#xd800;", writer.toString());
231
232         writer = new StringWriter();
233         xmlOut = new XmlOut(writer);
234         xmlOut.charRefOut('亜');
235         xmlOut.close();
236         assertEquals("&#x4e9c;", writer.toString());
237
238         return;
239     }
240
241     /**
242      * Test of dumpRawData method, of class XmlUtils.
243      * @throws java.lang.Exception
244      */
245     @Test
246     public void testDumpRawData() throws Exception {
247         System.out.println("dumpInvalidChar");
248
249         Writer writer;
250         XmlOut xmlOut;
251
252         writer = new StringWriter();
253         xmlOut = new XmlOut(writer);
254         xmlOut.dumpRawData('\u0000');
255         xmlOut.close();
256         assertEquals("<rawdata encoding=\"Shift_JIS\" hexBin=\"00\" >\u2400</rawdata>", writer.toString());
257
258         writer = new StringWriter();
259         xmlOut = new XmlOut(writer);
260         xmlOut.dumpRawData('\u001f');
261         xmlOut.close();
262         assertEquals("<rawdata encoding=\"Shift_JIS\" hexBin=\"1f\" >\u241f</rawdata>", writer.toString());
263
264         writer = new StringWriter();
265         xmlOut = new XmlOut(writer);
266         xmlOut.dumpRawData('\u0020');
267         xmlOut.close();
268         assertEquals("<rawdata encoding=\"Shift_JIS\" hexBin=\"20\" >\ufffd</rawdata>", writer.toString());
269
270         writer = new StringWriter();
271         xmlOut = new XmlOut(writer);
272         xmlOut.dumpRawData('\u00ff');
273         xmlOut.close();
274         assertEquals("<rawdata encoding=\"Shift_JIS\" hexBin=\"ff\" >\ufffd</rawdata>", writer.toString());
275
276         writer = new StringWriter();
277         xmlOut = new XmlOut(writer);
278         xmlOut.dumpRawData('\u0100');
279         xmlOut.close();
280         assertEquals("<rawdata encoding=\"Shift_JIS\" hexBin=\"0100\" >\ufffd</rawdata>", writer.toString());
281
282         return;
283     }
284
285     /**
286      * Test of charDataOut method, of class XmlUtils.
287      * @throws java.lang.Exception
288      */
289     @Test
290     public void testCharDataOut() throws Exception {
291         System.out.println("textOut");
292
293         Writer writer;
294         XmlOut xmlOut;
295
296         writer = new StringWriter();
297         xmlOut = new XmlOut(writer);
298         xmlOut.charDataOut("ABC");
299         xmlOut.close();
300         assertEquals("ABC", writer.toString());
301
302         writer = new StringWriter();
303         xmlOut = new XmlOut(writer);
304         xmlOut.charDataOut("&<>\"'");
305         xmlOut.close();
306         assertEquals("&amp;&lt;&gt;&quot;&apos;", writer.toString());
307
308         writer = new StringWriter();
309         xmlOut = new XmlOut(writer);
310         xmlOut.charDataOut("A\u0008B");
311         xmlOut.close();
312         assertEquals("A<rawdata encoding=\"Shift_JIS\" hexBin=\"08\" >\u2408</rawdata>B", writer.toString());
313
314         writer = new StringWriter();
315         xmlOut = new XmlOut(writer);
316         xmlOut.charDataOut("A\u007fB");
317         xmlOut.close();
318         assertEquals("A\u007fB", writer.toString());
319
320         writer = new StringWriter();
321         xmlOut = new XmlOut(writer);
322         xmlOut.charDataOut("A\u009fB");
323         xmlOut.close();
324         assertEquals("A\u009fB", writer.toString());
325
326         writer = new StringWriter();
327         xmlOut = new XmlOut(writer);
328         xmlOut.charDataOut("A\u00a0B");
329         xmlOut.close();
330         assertEquals("A\u00a0B", writer.toString());
331
332         writer = new StringWriter();
333         xmlOut = new XmlOut(writer);
334         xmlOut.charDataOut("A\\B");
335         xmlOut.close();
336         assertEquals("A¥B", writer.toString());
337
338         writer = new StringWriter();
339         xmlOut = new XmlOut(writer);
340         xmlOut.charDataOut("A~B");
341         xmlOut.close();
342         assertEquals("A‾B", writer.toString());
343
344         writer = new StringWriter();
345         xmlOut = new XmlOut(writer);
346         xmlOut.charDataOut("A\u0020\u0020");
347         xmlOut.close();
348         assertEquals("A &#x20;", writer.toString());
349
350         writer = new StringWriter();
351         xmlOut = new XmlOut(writer);
352         xmlOut.charDataOut("A\u0020");
353         xmlOut.close();
354         assertEquals("A&#x20;", writer.toString());
355
356         writer = new StringWriter();
357         xmlOut = new XmlOut(writer);
358         xmlOut.charDataOut("A\u0020B");
359         xmlOut.close();
360         assertEquals("A B", writer.toString());
361
362         writer = new StringWriter();
363         xmlOut = new XmlOut(writer);
364         xmlOut.charDataOut("A\u0020");
365         xmlOut.close();
366         assertEquals("A&#x20;", writer.toString());
367
368         writer = new StringWriter();
369         xmlOut = new XmlOut(writer);
370         xmlOut.charDataOut("A\u0020\u0020B");
371         xmlOut.close();
372         assertEquals("A &#x20;B", writer.toString());
373
374         writer = new StringWriter();
375         xmlOut = new XmlOut(writer);
376         xmlOut.charDataOut("\u0020\u0020B");
377         xmlOut.close();
378         assertEquals("&#x20;&#x20;B", writer.toString());
379
380         writer = new StringWriter();
381         xmlOut = new XmlOut(writer);
382         xmlOut.charDataOut("A\u0020\u0020\u0020B");
383         xmlOut.close();
384         assertEquals("A &#x20;&#x20;B", writer.toString());
385
386         writer = new StringWriter();
387         xmlOut = new XmlOut(writer);
388         xmlOut.charDataOut("\u0020\u0020\u0020B");
389         xmlOut.close();
390         assertEquals("&#x20;&#x20;&#x20;B", writer.toString());
391
392         return;
393     }
394
395     /**
396      * Test of attrOut method, of class XmlUtils.
397      * @throws java.lang.Exception
398      */
399     @Test
400     public void testAttrOut() throws Exception {
401         System.out.println("attrOut");
402
403         Writer writer;
404         XmlOut xmlOut;
405
406         writer = new StringWriter();
407         xmlOut = new XmlOut(writer);
408         xmlOut.attrOut("A", "B");
409         xmlOut.close();
410         assertEquals("A=\"B\"", writer.toString());
411
412         writer = new StringWriter();
413         xmlOut = new XmlOut(writer);
414         xmlOut.attrOut("A", "B\u0008C");
415         xmlOut.close();
416         assertEquals("A=\"B\u0008C\"", writer.toString());
417
418         writer = new StringWriter();
419         xmlOut = new XmlOut(writer);
420         xmlOut.attrOut("A", "B\nC\rD\tE");
421         xmlOut.close();
422         assertEquals("A=\"B\nC\rD\tE\"", writer.toString());
423
424         return;
425     }
426
427     /**
428      * Test of timeAttrOut method, of class XmlUtils.
429      * @throws java.lang.Exception
430      */
431     @Test
432     public void testTimeAttrOut() throws Exception {
433         System.out.println("timeAttrOut");
434
435         Writer writer;
436         XmlOut xmlOut;
437
438         writer = new StringWriter();
439         xmlOut = new XmlOut(writer);
440         xmlOut.timeAttrOut("A", 0, 0);
441         xmlOut.close();
442         assertEquals("A=\"00:00:00+09:00\"", writer.toString());
443
444         writer = new StringWriter();
445         xmlOut = new XmlOut(writer);
446         xmlOut.timeAttrOut("A", 9, 9);
447         xmlOut.close();
448         assertEquals("A=\"09:09:00+09:00\"", writer.toString());
449
450         writer = new StringWriter();
451         xmlOut = new XmlOut(writer);
452         xmlOut.timeAttrOut("A", 23, 59);
453         xmlOut.close();
454         assertEquals("A=\"23:59:00+09:00\"", writer.toString());
455
456         return;
457     }
458
459     /**
460      * Test of dateAttrOut method, of class XmlUtils.
461      * @throws java.lang.Exception
462      */
463     @Test
464     public void testDateAttrOut() throws Exception {
465         System.out.println("dateAttrOut");
466
467         Writer writer;
468         XmlOut xmlOut;
469
470         writer = new StringWriter();
471         xmlOut = new XmlOut(writer);
472         xmlOut.dateAttrOut("A", 1, 1);
473         xmlOut.close();
474         assertEquals("A=\"--01-01+09:00\"", writer.toString());
475
476         writer = new StringWriter();
477         xmlOut = new XmlOut(writer);
478         xmlOut.dateAttrOut("A", 2, 29);
479         xmlOut.close();
480         assertEquals("A=\"--02-29+09:00\"", writer.toString());
481
482         writer = new StringWriter();
483         xmlOut = new XmlOut(writer);
484         xmlOut.dateAttrOut("A", 12, 31);
485         xmlOut.close();
486         assertEquals("A=\"--12-31+09:00\"", writer.toString());
487
488         return;
489     }
490
491     /**
492      * Test of dateTimeAttr method, of class XmlUtils.
493      * @throws java.lang.Exception
494      */
495     @Test
496     public void testDateTimeAttr() throws Exception {
497         System.out.println("dateTimeAttr");
498
499         Writer writer;
500         XmlOut xmlOut;
501
502         writer = new StringWriter();
503         xmlOut = new XmlOut(writer);
504         xmlOut.dateTimeAttr("A", 0L);
505         xmlOut.close();
506         assertEquals("A=\"1970-01-01T09:00:00.000+09:00\"", writer.toString());
507
508         writer = new StringWriter();
509         xmlOut = new XmlOut(writer);
510         xmlOut.dateTimeAttr("A", 1466871486000L);
511         xmlOut.close();
512         assertEquals("A=\"2016-06-26T01:18:06.000+09:00\"", writer.toString());
513
514         return;
515     }
516
517     /**
518      * Test of dumpSjisMapError method, of class XmlUtils.
519      * @throws java.lang.Exception
520      */
521     @Test
522     public void testDumpDecodeError() throws Exception {
523         System.out.println("dumpErrorInfo");
524
525         Writer writer;
526         XmlOut xmlOut;
527         DecodeErrorInfo errorInfo;
528
529         writer = new StringWriter();
530         xmlOut = new XmlOut(writer);
531         errorInfo = new DecodeErrorInfo(0, (byte) 0x00);
532         xmlOut.dumpErrorInfo(errorInfo);
533         xmlOut.close();
534         assertEquals("<rawdata encoding=\"Shift_JIS\" hexBin=\"00\" >\u2400</rawdata>", writer.toString());
535
536         writer = new StringWriter();
537         xmlOut = new XmlOut(writer);
538         errorInfo = new DecodeErrorInfo(0, (byte) 0x0f);
539         xmlOut.dumpErrorInfo(errorInfo);
540         xmlOut.close();
541         assertEquals("<rawdata encoding=\"Shift_JIS\" hexBin=\"0f\" >\u240f</rawdata>", writer.toString());
542
543         writer = new StringWriter();
544         xmlOut = new XmlOut(writer);
545         errorInfo = new DecodeErrorInfo(0, (byte) 0x10);
546         xmlOut.dumpErrorInfo(errorInfo);
547         xmlOut.close();
548         assertEquals("<rawdata encoding=\"Shift_JIS\" hexBin=\"10\" >\u2410</rawdata>", writer.toString());
549
550         writer = new StringWriter();
551         xmlOut = new XmlOut(writer);
552         errorInfo = new DecodeErrorInfo(0, (byte) 0xff);
553         xmlOut.dumpErrorInfo(errorInfo);
554         xmlOut.close();
555         assertEquals("<rawdata encoding=\"Shift_JIS\" hexBin=\"ff\" >\ufffd</rawdata>", writer.toString());
556
557         writer = new StringWriter();
558         xmlOut = new XmlOut(writer);
559         errorInfo = new DecodeErrorInfo(0, (byte) 0xee, (byte) 0xef); //92区
560         xmlOut.dumpErrorInfo(errorInfo);
561         xmlOut.close();
562         assertEquals("<rawdata encoding=\"Shift_JIS\" hexBin=\"eeef\" >\u2170</rawdata>", writer.toString());
563
564         return;
565     }
566
567     /**
568      * Test of dumpDecodedContent method, of class XmlUtils.
569      * @throws java.lang.Exception
570      */
571     @Test
572     public void testDumpDecodedContent() throws Exception {
573         System.out.println("dumpDecodedContent");
574
575         Writer writer;
576         XmlOut xmlOut;
577         DecodedContent content;
578
579         writer = new StringWriter();
580         xmlOut = new XmlOut(writer);
581         content = new DecodedContent("ABC");
582         xmlOut.dumpDecodedContent(content);
583         xmlOut.close();
584         assertEquals("ABC", writer.toString());
585
586         writer = new StringWriter();
587         xmlOut = new XmlOut(writer);
588         content = new DecodedContent();
589         content.append("AB");
590         content.addDecodeError((byte)0x08);
591         content.append("CD");
592         xmlOut.dumpDecodedContent(content);
593         xmlOut.close();
594         assertEquals("AB<rawdata encoding=\"Shift_JIS\" hexBin=\"08\" >\u2408</rawdata>CD", writer.toString());
595
596         writer = new StringWriter();
597         xmlOut = new XmlOut(writer);
598         content = new DecodedContent();
599         content.append("AB");
600         content.addDecodeError((byte)0x08);
601         xmlOut.dumpDecodedContent(content);
602         xmlOut.close();
603         assertEquals("AB<rawdata encoding=\"Shift_JIS\" hexBin=\"08\" >\u2408</rawdata>", writer.toString());
604
605         writer = new StringWriter();
606         xmlOut = new XmlOut(writer);
607         content = new DecodedContent();
608         content.addDecodeError((byte)0x08);
609         content.append("CD");
610         xmlOut.dumpDecodedContent(content);
611         xmlOut.close();
612         assertEquals("<rawdata encoding=\"Shift_JIS\" hexBin=\"08\" >\u2408</rawdata>CD", writer.toString());
613
614         return;
615     }
616
617     /**
618      * Test of isXmlChar method, of class XmlOut.
619      */
620     @Test
621     public void testIsXmlChar() {
622         System.out.println("isXmlChar");
623
624         assertFalse(XmlOut.isXmlChar('\u0000'));
625         assertFalse(XmlOut.isXmlChar('\u001f'));
626
627         assertTrue(XmlOut.isXmlChar('\n'));
628         assertTrue(XmlOut.isXmlChar('\r'));
629         assertTrue(XmlOut.isXmlChar('\t'));
630
631         assertTrue(XmlOut.isXmlChar('\u0020'));
632         assertTrue(XmlOut.isXmlChar('A'));
633         assertTrue(XmlOut.isXmlChar('\ud7ff'));
634
635         assertTrue(XmlOut.isXmlChar('\ud800'));
636         assertTrue(XmlOut.isXmlChar('\udbff'));
637
638         assertTrue(XmlOut.isXmlChar('\udc00'));
639         assertTrue(XmlOut.isXmlChar('\udfff'));
640
641         assertTrue(XmlOut.isXmlChar('\ue000'));
642         assertTrue(XmlOut.isXmlChar('\ufffd'));
643
644         assertFalse(XmlOut.isXmlChar('\ufffe'));
645         assertFalse(XmlOut.isXmlChar('\uffff'));
646
647         return;
648     }
649
650     /**
651      * Test of replaceChar method, of class XmlOut.
652      */
653     @Test
654     public void testReplaceChar() {
655         System.out.println("replaceChar");
656
657         char result;
658
659         result = XmlOut.replaceChar('\u0000');
660         assertEquals('\u2400', result);
661
662         result = XmlOut.replaceChar('\u001f');
663         assertEquals('\u241f', result);
664
665         result = XmlOut.replaceChar('\u007f');
666         assertEquals('\u2421', result);
667
668         result = XmlOut.replaceChar('A');
669         assertEquals('\ufffd', result);
670
671         return;
672     }
673
674     /**
675      * Test of toHex method, of class XmlOut.
676      */
677     @Test
678     public void testToHex_byte() {
679         System.out.println("toHex");
680
681         byte bVal;
682         String result;
683
684         bVal = 0x00;
685         result = XmlOut.toHex(bVal);
686         assertEquals("00", result);
687
688         bVal = 0x0a;
689         result = XmlOut.toHex(bVal);
690         assertEquals("0a", result);
691
692         bVal = 0x7f;
693         result = XmlOut.toHex(bVal);
694         assertEquals("7f", result);
695
696         bVal = (byte) 0x80;
697         result = XmlOut.toHex(bVal);
698         assertEquals("80", result);
699
700         bVal = (byte) 0xff;
701         result = XmlOut.toHex(bVal);
702         assertEquals("ff", result);
703
704         return;
705     }
706
707     /**
708      * Test of toHex method, of class XmlOut.
709      */
710     @Test
711     public void testToHex_char() {
712         System.out.println("toHex");
713
714         char cVal;
715         String result;
716
717         cVal = '\u0000';
718         result = XmlOut.toHex(cVal);
719         assertEquals("00", result);
720
721         cVal = '\u000b';
722         result = XmlOut.toHex(cVal);
723         assertEquals("0b", result);
724
725         cVal = '\u00ff';
726         result = XmlOut.toHex(cVal);
727         assertEquals("ff", result);
728
729         cVal = '\u0100';
730         result = XmlOut.toHex(cVal);
731         assertEquals("0100", result);
732
733         cVal = '\u7fff';
734         result = XmlOut.toHex(cVal);
735         assertEquals("7fff", result);
736
737         cVal = '\u8000';
738         result = XmlOut.toHex(cVal);
739         assertEquals("8000", result);
740
741         cVal = '\uffff';
742         result = XmlOut.toHex(cVal);
743         assertEquals("ffff", result);
744
745         return;
746     }
747
748     /**
749      * Test of toHex method, of class XmlOut.
750      */
751     @Test
752     public void testToHex_short() {
753         System.out.println("toHex");
754
755         short sVal;
756         String result;
757
758         sVal = 0x0000;
759         result = XmlOut.toHex(sVal);
760         assertEquals("0000", result);
761
762         sVal = 0x00ff;
763         result = XmlOut.toHex(sVal);
764         assertEquals("00ff", result);
765
766         sVal = 0x7fff;
767         result = XmlOut.toHex(sVal);
768         assertEquals("7fff", result);
769
770         sVal = (short) 0x8000;
771         result = XmlOut.toHex(sVal);
772         assertEquals("8000", result);
773
774         sVal = (short) 0xffff;
775         result = XmlOut.toHex(sVal);
776         assertEquals("ffff", result);
777
778         return;
779     }
780
781 }