This page was generated using Webiyo. See its source code and unit tests.
|
org/webiyo/examples/sourceforge/ViewSourcePageTest.javapackage org.webiyo.examples.sourceforge; import junit.framework.TestCase; import org.webiyo.examples.viewjava.SourceFile; import org.webiyo.examples.viewjava.SourceIndex; import org.webiyo.util.test.ElementChecker; import java.io.File; public class ViewSourcePageTest extends TestCase { public static final FakeProject FAKE_PROJECT = new FakeProject(new File("test/data/JavaProjectTest"), "src", "src2"); public void testRender() throws Exception { SourceIndex sourceIndex = FAKE_PROJECT.getSourceIndex(); SourceFile hello = sourceIndex.getSourceFile("Hello"); assertNotNull(hello); ViewSourcePage viewSourcePage = new ViewSourcePage(FAKE_PROJECT, hello); SourceForgePageChecker page = new SourceForgePageChecker(viewSourcePage); page.checkBasics("Webiyo - Hello.java", "../"); ElementChecker sourceDiv = page.navigateTo("//div[@class='java-file']"); sourceDiv.checkText("Hello.java", "h2"); sourceDiv.checkText("public class Hello {\n" + " // comment\n" + " public static void main(String[] args) {\n" + " System.out.println(\"hello\");\n" + " }\n" + "}\n", "pre"); sourceDiv.checkText("public", "pre/span[1]"); sourceDiv.checkText("jkeyword", "pre/span[1]/@class"); sourceDiv.checkText("\"hello\"", "pre/span[@class='jquote']"); sourceDiv.checkText("// comment", "pre/span[@class='jcomment']"); } public void testStylesheetLinkInPackage() throws Exception { SourceFile file = FAKE_PROJECT.getSourceIndex().getSourceFile("package1.File1"); assertNotNull(file); ViewSourcePage viewSourcePage = new ViewSourcePage(FAKE_PROJECT, file); SourceForgePageChecker page = new SourceForgePageChecker(viewSourcePage); page.checkBasics("Webiyo - package1/File1.java", "../../"); } } |