forked from fortiss-cce/fitnesse-html-util
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HtmlUtilTest.java
32 lines (26 loc) · 1.13 KB
/
HtmlUtilTest.java
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
import fitnesse.wiki.InMemoryPage;
import fitnesse.wiki.PageCrawler;
import fitnesse.wiki.PathParser;
import fitnesse.wiki.WikiPage;
import junit.framework.TestCase;
public class HtmlUtilTest extends TestCase {
public void testTestableHtml() throws Exception {
WikiPage root = InMemoryPage.makeRoot("RooT");
PageCrawler crawler = root.getPageCrawler();
crawler.addPage(root, PathParser.parse("SetUp"), "setup");
crawler.addPage(root, PathParser.parse("TearDown"), "teardown");
WikiPage page = crawler.addPage(root, PathParser.parse("TestPage"), "the content");
String html = HtmlUtil.testableHtml(page.getData(), false);
assertSubString(".SetUp", html);
assertSubString("setup", html);
assertSubString(".TearDown", html);
assertSubString("teardown", html);
assertSubString("the content", html);
assertSubString("class=\"collapsable\"", html);
}
public static void assertSubString(String substring, String string) {
if (!string.contains(substring)) {
fail("substring '" + substring + "' not found.");
}
}
}