| 1 | | | |
| 2 | | | |
| 3 | | | |
| 4 | | | |
| 5 | | | |
| 6 | | | |
| 7 | | | |
| 8 | | | |
| 9 | | | |
| 10 | | | |
| 11 | | | |
| 12 | | | |
| 13 | | | |
| 14 | | | |
| 15 | | | |
| 16 | | | |
| 17 | | | |
| 18 | | | |
| 19 | | | |
| 20 | | | |
| 21 | | | |
| 22 | | | |
| 23 | | | |
| 24 | | | |
| 25 | | | |
| 26 | | | |
| 27 | | | |
| 28 | | | |
| 29 | | | |
| 30 | | | |
| 31 | | | |
| 32 | | | |
| 33 | | | package org.jcoderz.commons.doclet; |
| 34 | | | |
| 35 | | | import junit.framework.TestCase; |
| 36 | | | |
| 37 | | | |
| 38 | | | |
| 39 | | | @author |
| 40 | | | |
| 41 | 100 | | public class HtmlCleanerTest |
| 42 | | | extends TestCase |
| 43 | | | { |
| 44 | | | |
| 45 | | | |
| 46 | | | @throws |
| 47 | | | |
| 48 | | | public void testSimpleClean () |
| 49 | | | throws Exception |
| 50 | | | { |
| 51 | 100 | | assertEquals("Cleaned output unexpected.", |
| 52 | | | "<p>test</p>", |
| 53 | | | new HtmlCleaner().clean("<p>test</p>")); |
| 54 | 100 | | } |
| 55 | | | |
| 56 | | | |
| 57 | | | |
| 58 | | | @throws |
| 59 | | | |
| 60 | | | public void testBrokenClean () |
| 61 | | | throws Exception |
| 62 | | | { |
| 63 | 100 | | final HtmlCleaner htmlCleaner = new HtmlCleaner(); |
| 64 | 100 | | assertEquals("Cleaned output unexpected.", |
| 65 | | | "Invalid HTML could not be parsed.", |
| 66 | | | htmlCleaner.clean("&&foo;<table><test> <br><p>test")); |
| 67 | 75 | | assertTrue("Error message unexpected. " + htmlCleaner.getWarnings(), |
| 68 | | | htmlCleaner.getWarnings().indexOf("<test>") >= 0); |
| 69 | 100 | | } |
| 70 | | | } |