public void testCleanAndConvert() { String input = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n" + "<HTML><HEAD>" + "<META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=utf-8\">" + "<TITLE></TITLE>" + "<META NAME=\"GENERATOR\" CONTENT=\"OpenOffice.org 3.0 (Linux)\">" + "<META NAME=\"CREATED\" CONTENT=\"0;0\">" + "<META NAME=\"CHANGED\" CONTENT=\"20090627;12430300\">" + "</HEAD>" + "<BODY LANG=\"en-US\" DIR=\"LTR\">" + "<UL> <LI><P STYLE=\"margin-bottom: 0in\">list1</P><UL><LI><P>list 2</P></UL></UL>" + "<P>test</P>" + "</BODY></HTML>"; String expected = "* list1\n** list 2\n\ntest"; String result = null; try { result = converter.fromXHTML(cleaner.clean(input)); } catch (ConversionException e) { e.printStackTrace(); } assertEquals(result, expected); }
public void testToXHTML() { String input = "test1\n"; String expected = "<p>test1</p>"; String result = null; try { result = converter.toXHTML(input); } catch (ConversionException e) { e.printStackTrace(); } assertEquals(result, expected); }
public void testFromXHTML() { String input = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" + "<html><head></head><body><p>test1</p><div class=\"wikimodel-emptyline\"></div></body></html>\n"; String expected = "test1\n"; String result = null; try { result = converter.fromXHTML(input); } catch (ConversionException e) { e.printStackTrace(); } assertEquals(result, expected); }