KickJava   Java API By Example, From Geeks To Geeks.

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


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 for Report messages. <strong>This test case actually requires EN locale to run successfully. </strong>.
61  * @author fgiust
62  * @version $Revision: 1.11 $ ($Author: fgiust $)
63  */

64 public class ReportTest extends TestCase
65 {
66
67     /**
68      * report instance.
69      */

70     private Report report;
71
72     /**
73      * lexer instance.
74      */

75     private Lexer lexer;
76
77     /**
78      * instantiates a new test.
79      * @param name test name
80      */

81     public ReportTest(String JavaDoc name)
82     {
83         super(name);
84     }
85
86     /**
87      * @see junit.framework.TestCase#setUp()
88      */

89     protected void setUp() throws Exception JavaDoc
90     {
91         super.setUp();
92         this.report = new Report();
93         this.lexer = new Lexer(null, new Configuration(report), this.report);
94         lexer.lines = 12;
95         lexer.columns = 34;
96     }
97
98     /**
99      * test getMessage with the <code>missing_endtag_for</code> key.
100      * @throws Exception any Exception generated during test
101      */

102     public void testGetMessageMissingEndtagFor() throws Exception JavaDoc
103     {
104         String JavaDoc message = this.report.getMessage(
105             -1,
106             lexer,
107             "missing_endtag_for",
108             new Object JavaDoc[]{"test"},
109             TidyMessage.Level.WARNING);
110         assertEquals("line 12 column 34 - Warning: missing </test>", message);
111     }
112
113     /**
114      * test getMessage with the <code>missing_endtag_before</code> key.
115      * @throws Exception any Exception generated during test
116      */

117     public void testGetMessageMissingEndtagBefore() throws Exception JavaDoc
118     {
119         String JavaDoc message = this.report.getMessage(
120             -1,
121             lexer,
122             "missing_endtag_before",
123             new Object JavaDoc[]{"test", "bee"},
124             TidyMessage.Level.WARNING);
125         assertEquals("line 12 column 34 - Warning: missing </test> before bee", message);
126     }
127
128     /**
129      * test getMessage with the <code>discarding_unexpected</code> key.
130      * @throws Exception any Exception generated during test
131      */

132     public void testGetMessageDiscardingUnexpected() throws Exception JavaDoc
133     {
134         String JavaDoc message = this.report.getMessage(
135             -1,
136             lexer,
137             "discarding_unexpected",
138             new Object JavaDoc[]{"test"},
139             TidyMessage.Level.WARNING);
140         assertEquals("line 12 column 34 - Warning: discarding unexpected test", message);
141     }
142
143     /**
144      * test getMessage with the <code>nested_emphasis</code> key.
145      * @throws Exception any Exception generated during test
146      */

147     public void testGetMessageNestedEmphasis() throws Exception JavaDoc
148     {
149         String JavaDoc message = this.report.getMessage(
150             -1,
151             lexer,
152             "nested_emphasis",
153             new Object JavaDoc[]{"test"},
154             TidyMessage.Level.INFO);
155         assertEquals("line 12 column 34 - nested emphasis test", message);
156     }
157
158     /**
159      * test getMessage with the <code>coerce_to_endtag</code> key.
160      * @throws Exception any Exception generated during test
161      */

162     public void testGetMessageCoerceToEndtag() throws Exception JavaDoc
163     {
164         String JavaDoc message = this.report.getMessage(
165             -1,
166             lexer,
167             "coerce_to_endtag",
168             new Object JavaDoc[]{"test"},
169             TidyMessage.Level.INFO);
170         assertEquals("line 12 column 34 - <test> is probably intended as </test>", message);
171     }
172
173     /**
174      * test getMessage with the <code>non_matching_endtag</code> key.
175      * @throws Exception any Exception generated during test
176      */

177     public void testGetMessageNonMatchingEndtag() throws Exception JavaDoc
178     {
179         String JavaDoc message = this.report.getMessage(
180             -1,
181             lexer,
182             "non_matching_endtag",
183             new Object JavaDoc[]{"<test>", "bee"},
184             TidyMessage.Level.WARNING);
185         assertEquals("line 12 column 34 - Warning: replacing unexpected <test> by </bee>", message);
186     }
187
188     /**
189      * test getMessage with the <code>tag_not_allowed_in</code> key.
190      * @throws Exception any Exception generated during test
191      */

192     public void testGetMessageTagNonAllowedIn() throws Exception JavaDoc
193     {
194         String JavaDoc message = this.report.getMessage(
195             -1,
196             lexer,
197             "tag_not_allowed_in",
198             new Object JavaDoc[]{"<test>", "bee"},
199             TidyMessage.Level.WARNING);
200         assertEquals("line 12 column 34 - Warning: <test> isn't allowed in <bee> elements", message);
201     }
202
203     /**
204      * test getMessage with the <code>doctype_after_tags</code> key.
205      * @throws Exception any Exception generated during test
206      */

207     public void testGetMessageDoctypeAfterTags() throws Exception JavaDoc
208     {
209         String JavaDoc message = this.report.getMessage(-1, lexer, "doctype_after_tags", null, TidyMessage.Level.WARNING);
210         assertEquals("line 12 column 34 - Warning: <!DOCTYPE> isn't allowed after elements", message);
211     }
212
213     /**
214      * test getMessage with the <code>missing_starttag</code> key.
215      * @throws Exception any Exception generated during test
216      */

217     public void testGetMessageMissingStarttag() throws Exception JavaDoc
218     {
219         String JavaDoc message = this.report.getMessage(
220             -1,
221             lexer,
222             "missing_starttag",
223             new Object JavaDoc[]{"test"},
224             TidyMessage.Level.WARNING);
225         assertEquals("line 12 column 34 - Warning: missing <test>", message);
226     }
227
228     /**
229      * test getMessage with the <code>using_br_inplace_of</code> key.
230      * @throws Exception any Exception generated during test
231      */

232     public void testGetMessageUsingBrInPlaceOf() throws Exception JavaDoc
233     {
234         String JavaDoc message = this.report.getMessage(
235             -1,
236             lexer,
237             "using_br_inplace_of",
238             new Object JavaDoc[]{"test"},
239             TidyMessage.Level.WARNING);
240         assertEquals("line 12 column 34 - Warning: using <br> in place of test", message);
241     }
242
243     /**
244      * test getMessage with the <code>inserting_tag</code> key.
245      * @throws Exception any Exception generated during test
246      */

247     public void testGetMessageInsertingTag() throws Exception JavaDoc
248     {
249         String JavaDoc message = this.report.getMessage(
250             -1,
251             lexer,
252             "inserting_tag",
253             new Object JavaDoc[]{"test"},
254             TidyMessage.Level.WARNING);
255         assertEquals("line 12 column 34 - Warning: inserting implicit <test>", message);
256     }
257
258     /**
259      * test getMessage with the <code>cant_be_nested</code> key.
260      * @throws Exception any Exception generated during test
261      */

262     public void testGetMessageCantBeNested() throws Exception JavaDoc
263     {
264         String JavaDoc message = this.report.getMessage(
265             -1,
266             lexer,
267             "cant_be_nested",
268             new Object JavaDoc[]{"<test>"},
269             TidyMessage.Level.WARNING);
270         assertEquals("line 12 column 34 - Warning: <test> can't be nested", message);
271     }
272
273     /**
274      * test getMessage with the <code>proprietary_element</code> key.
275      * @throws Exception any Exception generated during test
276      */

277     public void testGetMessageProprietaryElement() throws Exception JavaDoc
278     {
279         String JavaDoc message = this.report.getMessage(
280             -1,
281             lexer,
282             "proprietary_element",
283             new Object JavaDoc[]{"<test>"},
284             TidyMessage.Level.WARNING);
285         assertEquals("line 12 column 34 - Warning: <test> is not approved by W3C", message);
286     }
287
288     /**
289      * test getMessage with the <code>obsolete_element</code> key.
290      * @throws Exception any Exception generated during test
291      */

292     public void testGetMessageObsoleteElement() throws Exception JavaDoc
293     {
294         String JavaDoc message = this.report.getMessage(
295             -1,
296             lexer,
297             "obsolete_element",
298             new Object JavaDoc[]{"<test>", "<bee>"},
299             TidyMessage.Level.WARNING);
300         assertEquals("line 12 column 34 - Warning: replacing obsolete element <test> by <bee>", message);
301     }
302
303     /**
304      * test getMessage with the <code>replacing_element</code> key.
305      * @throws Exception any Exception generated during test
306      */

307     public void testGetMessageReplacingElement() throws Exception JavaDoc
308     {
309         String JavaDoc message = this.report.getMessage(
310             -1,
311             lexer,
312             "replacing_element",
313             new Object JavaDoc[]{"<test>", "<bee>"},
314             TidyMessage.Level.WARNING);
315         assertEquals("line 12 column 34 - Warning: replacing element <test> by <bee>", message);
316     }
317
318     /**
319      * test getMessage with the <code>trim_empty_element</code> key.
320      * @throws Exception any Exception generated during test
321      */

322     public void testGetMessageTrimEmptyElement() throws Exception JavaDoc
323     {
324         String JavaDoc message = this.report.getMessage(
325             -1,
326             lexer,
327             "trim_empty_element",
328             new Object JavaDoc[]{"<test>"},
329             TidyMessage.Level.WARNING);
330         assertEquals("line 12 column 34 - Warning: trimming empty <test>", message);
331     }
332
333     /**
334      * test getMessage with the <code>missing_title_element</code> key.
335      * @throws Exception any Exception generated during test
336      */

337     public void testGetMessageMissingTitleElement() throws Exception JavaDoc
338     {
339         String JavaDoc message = this.report.getMessage(-1, lexer, "missing_title_element", null, TidyMessage.Level.WARNING);
340         assertEquals("line 12 column 34 - Warning: inserting missing 'title' element", message);
341     }
342
343     /**
344      * test getMessage with the <code>illegal_nesting</code> key.
345      * @throws Exception any Exception generated during test
346      */

347     public void testGetMessageIllegalNesting() throws Exception JavaDoc
348     {
349         String JavaDoc message = this.report.getMessage(
350             -1,
351             lexer,
352             "illegal_nesting",
353             new Object JavaDoc[]{"<test>"},
354             TidyMessage.Level.WARNING);
355         assertEquals("line 12 column 34 - Warning: <test> shouldn't be nested", message);
356     }
357
358     /**
359      * test getMessage with the <code>noframes_content</code> key.
360      * @throws Exception any Exception generated during test
361      */

362     public void testGetMessageNoframesContent() throws Exception JavaDoc
363     {
364         String JavaDoc message = this.report.getMessage(
365             -1,
366             lexer,
367             "noframes_content",
368             new Object JavaDoc[]{"<test>"},
369             TidyMessage.Level.WARNING);
370         assertEquals("line 12 column 34 - Warning: <test> not inside 'noframes' element", message);
371     }
372
373     /**
374      * test getMessage with the <code>inconsistent_version</code> key.
375      * @throws Exception any Exception generated during test
376      */

377     public void testGetMessageInconsistentVersion() throws Exception JavaDoc
378     {
379         String JavaDoc message = this.report.getMessage(-1, lexer, "inconsistent_version", null, TidyMessage.Level.WARNING);
380         assertEquals("line 12 column 34 - Warning: html doctype doesn't match content", message);
381     }
382
383     /**
384      * test getMessage with the <code>malformed_doctype</code> key.
385      * @throws Exception any Exception generated during test
386      */

387     public void testGetMessageMalformedDoctype() throws Exception JavaDoc
388     {
389         String JavaDoc message = this.report.getMessage(-1, lexer, "malformed_doctype", null, TidyMessage.Level.WARNING);
390         assertEquals("line 12 column 34 - Warning: expected \"html PUBLIC\" or \"html SYSTEM\"", message);
391     }
392
393     /**
394      * test getMessage with the <code>content_after_body</code> key.
395      * @throws Exception any Exception generated during test
396      */

397     public void testGetMessageContentAfterBody() throws Exception JavaDoc
398     {
399         String JavaDoc message = this.report.getMessage(-1, lexer, "content_after_body", null, TidyMessage.Level.WARNING);
400         assertEquals("line 12 column 34 - Warning: content occurs after end of body", message);
401     }
402
403     /**
404      * test getMessage with the <code>malformed_comment</code> key.
405      * @throws Exception any Exception generated during test
406      */

407     public void testGetMessageMalformedComment() throws Exception JavaDoc
408     {
409         String JavaDoc message = this.report.getMessage(-1, lexer, "malformed_comment", null, TidyMessage.Level.WARNING);
410         assertEquals("line 12 column 34 - Warning: adjacent hyphens within comment", message);
411     }
412
413     /**
414      * test getMessage with the <code>bad_comment_chars</code> key.
415      * @throws Exception any Exception generated during test
416      */

417     public void testGetMessageBadCommentChars() throws Exception JavaDoc
418     {
419         String JavaDoc message = this.report.getMessage(-1, lexer, "bad_comment_chars", null, TidyMessage.Level.WARNING);
420         assertEquals("line 12 column 34 - Warning: expecting -- or >", message);
421     }
422
423     /**
424      * test getMessage with the <code>bad_xml_comment</code> key.
425      * @throws Exception any Exception generated during test
426      */

427     public void testGetMessageBadXmlComment() throws Exception JavaDoc
428     {
429         String JavaDoc message = this.report.getMessage(-1, lexer, "bad_xml_comment", null, TidyMessage.Level.WARNING);
430         assertEquals("line 12 column 34 - Warning: XML comments can't contain --", message);
431     }
432
433     /**
434      * test getMessage with the <code>bad_cdata_content</code> key.
435      * @throws Exception any Exception generated during test
436      */

437     public void testGetMessageBadCdataComment() throws Exception JavaDoc
438     {
439         String JavaDoc message = this.report.getMessage(-1, lexer, "bad_cdata_content", null, TidyMessage.Level.WARNING);
440         assertEquals("line 12 column 34 - Warning: '<' + '/' + letter not allowed here", message);
441     }
442
443     /**
444      * test getMessage with the <code>inconsistent_namespace</code> key.
445      * @throws Exception any Exception generated during test
446      */

447     public void testGetMessageInconsistentNamespace() throws Exception JavaDoc
448     {
449         String JavaDoc message = this.report.getMessage(-1, lexer, "inconsistent_namespace", null, TidyMessage.Level.WARNING);
450         assertEquals("line 12 column 34 - Warning: html namespace doesn't match content", message);
451     }
452
453     /**
454      * test getMessage with the <code>dtype_not_upper_case</code> key.
455      * @throws Exception any Exception generated during test
456      */

457     public void testGetMessageDtypeNotUpperCase() throws Exception JavaDoc
458     {
459         String JavaDoc message = this.report.getMessage(-1, lexer, "dtype_not_upper_case", null, TidyMessage.Level.WARNING);
460         assertEquals("line 12 column 34 - Warning: SYSTEM, PUBLIC, W3C, DTD, EN must be upper case", message);
461     }
462
463     /**
464      * test getMessage with the <code>unexpected_end_of_file</code> key.
465      * @throws Exception any Exception generated during test
466      */

467     public void testGetMessageUnexpectedEndOfFile() throws Exception JavaDoc
468     {
469         String JavaDoc message = this.report.getMessage(
470             -1,
471             lexer,
472             "unexpected_end_of_file",
473             new Object JavaDoc[]{"<test>"},
474             TidyMessage.Level.WARNING);
475         assertEquals("line 12 column 34 - Warning: end of file while parsing attributes <test>", message);
476     }
477
478     /**
479      * test getMessage with the <code>suspected_missing_quote</code> key.
480      * @throws Exception any Exception generated during test
481      */

482     public void testGetMessageSuspectedMissingQuote() throws Exception JavaDoc
483     {
484         String JavaDoc message = this.report.getMessage(-1, lexer, "suspected_missing_quote", null, TidyMessage.Level.ERROR);
485         assertEquals("line 12 column 34 - Error: missing quotemark for attribute value", message);
486     }
487
488     /**
489      * test getMessage with the <code>duplicate_frameset</code> key.
490      * @throws Exception any Exception generated during test
491      */

492     public void testGetMessageDuplicateFrameset() throws Exception JavaDoc
493     {
494         String JavaDoc message = this.report.getMessage(-1, lexer, "duplicate_frameset", null, TidyMessage.Level.ERROR);
495         assertEquals("line 12 column 34 - Error: repeated FRAMESET element", message);
496     }
497
498     /**
499      * test getMessage with the <code>unknown_element</code> key.
500      * @throws Exception any Exception generated during test
501      */

502     public void testGetMessageUnknownElement() throws Exception JavaDoc
503     {
504         String JavaDoc message = this.report.getMessage(
505             -1,
506             lexer,
507             "unknown_element",
508             new Object JavaDoc[]{"<test>"},
509             TidyMessage.Level.ERROR);
510         assertEquals("line 12 column 34 - Error: <test> is not recognized!", message);
511     }
512
513     /**
514      * test getMessage with the <code>unexpected_endtag</code> key.
515      * @throws Exception any Exception generated during test
516      */

517     public void testGetMessageUnexpectedEndtag() throws Exception JavaDoc
518     {
519         String JavaDoc message = this.report.getMessage(
520             -1,
521             lexer,
522             "unexpected_endtag",
523             new Object JavaDoc[]{"test"},
524             TidyMessage.Level.ERROR);
525         assertEquals("line 12 column 34 - Error: unexpected </test>", message);
526     }
527
528     /**
529      * test getMessage with the <code>unexpected_endtag_in</code> key.
530      * @throws Exception any Exception generated during test
531      */

532     public void testGetMessageUnexpectedEndtagIn() throws Exception JavaDoc
533     {
534         String JavaDoc message = this.report.getMessage(
535             -1,
536             lexer,
537             "unexpected_endtag_in",
538             new Object JavaDoc[]{"test", "bee"},
539             TidyMessage.Level.ERROR);
540         assertEquals("line 12 column 34 - Error: unexpected </test> in <bee>", message);
541     }
542
543     /**
544      * test getMessage with the <code>too_many_elements</code> key.
545      * @throws Exception any Exception generated during test
546      */

547     public void testGetMessageTooManyElements() throws Exception JavaDoc
548     {
549         String JavaDoc message = this.report.getMessage(
550             -1,
551             lexer,
552             "too_many_elements",
553             new Object JavaDoc[]{"<test>"},
554             TidyMessage.Level.WARNING);
555         assertEquals("line 12 column 34 - Warning: too many <test> elements", message);
556     }
557
558     /**
559      * test getMessage with the <code>too_many_elements_in</code> key.
560      * @throws Exception any Exception generated during test
561      */

562     public void testGetMessageTooManyElementsIn() throws Exception JavaDoc
563     {
564         String JavaDoc message = this.report.getMessage(
565             -1,
566             lexer,
567             "too_many_elements_in",
568             new Object JavaDoc[]{"<test>", "bee"},
569             TidyMessage.Level.WARNING);
570         assertEquals("line 12 column 34 - Warning: too many <test> elements in <bee>", message);
571     }
572
573     /**
574      * test getMessage with the <code>unknown_attribute</code> key.
575      * @throws Exception any Exception generated during test
576      */

577     public void testGetMessageUnknownAttribute() throws Exception JavaDoc
578     {
579         String JavaDoc message = this.report.getMessage(
580             -1,
581             lexer,
582             "unknown_attribute",
583             new Object JavaDoc[]{"test"},
584             TidyMessage.Level.WARNING);
585         assertEquals("line 12 column 34 - Warning: unknown attribute \"test\"", message);
586     }
587
588     /**
589      * test getMessage with the <code>missing_attribute</code> key.
590      * @throws Exception any Exception generated during test
591      */

592     public void testGetMessageMissingAttribute() throws Exception JavaDoc
593     {
594         String JavaDoc message = this.report.getMessage(
595             -1,
596             lexer,
597             "missing_attribute",
598             new Object JavaDoc[]{"<test>", "bee"},
599             TidyMessage.Level.WARNING);
600         assertEquals("line 12 column 34 - Warning: <test> lacks \"bee\" attribute", message);
601     }
602
603     /**
604      * test getMessage with the <code>missing_attr_value</code> key.
605      * @throws Exception any Exception generated during test
606      */

607     public void testGetMessageMissingAttrValue() throws Exception JavaDoc
608     {
609         String JavaDoc message = this.report.getMessage(
610             -1,
611             lexer,
612             "missing_attr_value",
613             new Object JavaDoc[]{"<test>", "bee"},
614             TidyMessage.Level.WARNING);
615         assertEquals("line 12 column 34 - Warning: <test> attribute \"bee\" lacks value", message);
616     }
617
618     /**
619      * test getMessage with the <code>missing_imagemap</code> key.
620      * @throws Exception any Exception generated during test
621      */

622     public void testGetMessageMissingImagemap() throws Exception JavaDoc
623     {
624         String JavaDoc message = this.report.getMessage(
625             -1,
626             lexer,
627             "missing_imagemap",
628             new Object JavaDoc[]{"<test>"},
629             TidyMessage.Level.WARNING);
630         assertEquals("line 12 column 34 - Warning: <test> should use client-side image map", message);
631     }
632
633     /**
634      * test getMessage with the <code>bad_attribute_value</code> key.
635      * @throws Exception any Exception generated during test
636      */

637     public void testGetMessageBadAttributeValue() throws Exception JavaDoc
638     {
639         String JavaDoc message = this.report.getMessage(
640             -1,
641             lexer,
642             "bad_attribute_value",
643             new Object JavaDoc[]{"<test>", "bee", "ant"},
644             TidyMessage.Level.WARNING);
645         assertEquals("line 12 column 34 - Warning: <test> attribute \"bee\" has invalid value \"ant\"", message);
646     }
647
648     /**
649      * test getMessage with the <code>xml_attribute_value</code> key.
650      * @throws Exception any Exception generated during test
651      */

652     public void testGetMessageXmlAttributeValue() throws Exception JavaDoc
653     {
654         String JavaDoc message = this.report.getMessage(
655             -1,
656             lexer,
657             "xml_attribute_value",
658             new Object JavaDoc[]{"<test>", "bee"},
659             TidyMessage.Level.WARNING);
660         assertEquals("line 12 column 34 - Warning: <test> has XML attribute \"bee\"", message);
661     }
662
663     /**
664      * test getMessage with the <code>unexpected_gt</code> key.
665      * @throws Exception any Exception generated during test
666      */

667     public void testGetMessageUnexpectedGt() throws Exception JavaDoc
668     {
669         String JavaDoc message = this.report.getMessage(
670             -1,
671             lexer,
672             "unexpected_gt",
673             new Object JavaDoc[]{"<test>"},
674             TidyMessage.Level.ERROR);
675         assertEquals("line 12 column 34 - Error: <test> missing '>' for end of tag", message);
676     }
677
678     /**
679      * test getMessage with the <code>unexpected_quotemark</code> key.
680      * @throws Exception any Exception generated during test
681      */

682     public void testGetMessageUnexpectedQuotemark() throws Exception JavaDoc
683     {
684         String JavaDoc message = this.report.getMessage(
685             -1,
686             lexer,
687             "unexpected_quotemark",
688             new Object JavaDoc[]{"<test>"},
689             TidyMessage.Level.WARNING);
690         assertEquals("line 12 column 34 - Warning: <test> unexpected or duplicate quote mark", message);
691     }
692
693     /**
694      * test getMessage with the <code>repeated_attribute</code> key.
695      * @throws Exception any Exception generated during test
696      */

697     public void testGetMessageRepeatedAttribute() throws Exception JavaDoc
698     {
699         String JavaDoc message = this.report.getMessage(
700             -1,
701             lexer,
702             "repeated_attribute",
703             new Object JavaDoc[]{"<test>", "bee", "ant"},
704             TidyMessage.Level.WARNING);
705         assertEquals(
706             "line 12 column 34 - Warning: <test> dropping value \"bee\" for repeated attribute \"ant\"",
707             message);
708     }
709
710     /**
711      * test getMessage with the <code>proprietary_attr_value</code> key.
712      * @throws Exception any Exception generated during test
713      */

714     public void testGetMessageProprietaryAttrValue() throws Exception JavaDoc
715     {
716         String JavaDoc message = this.report.getMessage(
717             -1,
718             lexer,
719             "proprietary_attr_value",
720             new Object JavaDoc[]{"<test>", "bee"},
721             TidyMessage.Level.WARNING);
722         assertEquals("line 12 column 34 - Warning: <test> proprietary attribute value \"bee\"", message);
723     }
724
725     /**
726      * test getMessage with the <code>proprietary_attribute</code> key.
727      * @throws Exception any Exception generated during test
728      */

729     public void testGetMessageProprietaryAttribute() throws Exception JavaDoc
730     {
731         String JavaDoc message = this.report.getMessage(
732             -1,
733             lexer,
734             "proprietary_attribute",
735             new Object JavaDoc[]{"<test>", "bee"},
736             TidyMessage.Level.WARNING);
737         assertEquals("line 12 column 34 - Warning: <test> proprietary attribute \"bee\"", message);
738     }
739
740     /**
741      * test getMessage with the <code>id_name_mismatch</code> key.
742      * @throws Exception any Exception generated during test
743      */

744     public void testGetMessageIdNameMismatch() throws Exception JavaDoc
745     {
746         String JavaDoc message = this.report.getMessage(
747             -1,
748             lexer,
749             "id_name_mismatch",
750             new Object JavaDoc[]{"<test>"},
751             TidyMessage.Level.WARNING);
752         assertEquals("line 12 column 34 - Warning: <test> id and name attribute value mismatch", message);
753     }
754
755     /**
756      * test getMessage with the <code>missing_doctype</code> key.
757      * @throws Exception any Exception generated during test
758      */

759     public void testGetMessageMissingDoctype() throws Exception JavaDoc
760     {
761         String JavaDoc message = this.report.getMessage(-1, lexer, "missing_doctype", null, TidyMessage.Level.WARNING);
762         assertEquals("line 12 column 34 - Warning: missing <!DOCTYPE> declaration", message);
763     }
764
765     /**
766      * test getMessage with the <code>doctype_given</code> key.
767      * @throws Exception any Exception generated during test
768      */

769     public void testGetMessageDoctypeGiven() throws Exception JavaDoc
770     {
771         String JavaDoc message = this.report.getMessage(
772             -1,
773             lexer,
774             "doctype_given",
775             new Object JavaDoc[]{"test", "bee"},
776             TidyMessage.Level.SUMMARY);
777         assertEquals("test: Doctype given is \"bee\"", message);
778     }
779
780     /**
781      * test getMessage with the <code>report_version</code> key.
782      * @throws Exception any Exception generated during test
783      */

784     public void testGetMessageReportVersion() throws Exception JavaDoc
785     {
786         String JavaDoc message = this.report.getMessage(
787             -1,
788             lexer,
789             "report_version",
790             new Object JavaDoc[]{"test", "bee"},
791             TidyMessage.Level.SUMMARY);
792         assertEquals("test: Document content looks like bee", message);
793     }
794
795     /**
796      * test getMessage with the <code>xml_attribute_value</code> key.
797      * @throws Exception any Exception generated during test
798      */

799     public void testGetMessageNumWarning() throws Exception JavaDoc
800     {
801         String JavaDoc message = this.report.getMessage(
802             -1,
803             lexer,
804             "num_warnings",
805             new Object JavaDoc[]{new Integer JavaDoc(0), new Integer JavaDoc(33)},
806             TidyMessage.Level.SUMMARY);
807         assertEquals("no warnings, 33 errors were found!", message);
808     }
809
810 }
Popular Tags