01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.wikitext.widgets;
04:
05: import junit.swingui.TestRunner;
06: import fitnesse.testutil.FitNesseUtil;
07:
08: public class VirtualWikiWidgetTest extends AbstractWidget {
09: public static void main(String[] args) {
10: TestRunner.main(new String[] { "VirtualWikiWidgetTest" });
11: }
12:
13: public void setUp() throws Exception {
14: }
15:
16: public void tearDown() throws Exception {
17: }
18:
19: public void testRegexp() throws Exception {
20: assertMatches("!virtualwiki http://localhost:"
21: + FitNesseUtil.port + "/SomePage");
22: assertNoMatch("!virtualwiki SomeName");
23: }
24:
25: public void testPieces() throws Exception {
26: String text = "!virtualwiki http://localhost:"
27: + FitNesseUtil.port + "/SomePage.ChildPage";
28: VirtualWikiWidget widget = new VirtualWikiWidget(
29: new MockWidgetRoot(), text);
30: assertEquals("http://localhost:" + FitNesseUtil.port
31: + "/SomePage.ChildPage", widget.getRemoteUrl());
32: }
33:
34: public void testHtml() throws Exception {
35: String text = "!virtualwiki http://localhost:"
36: + FitNesseUtil.port + "/SomePage.ChildPage";
37: VirtualWikiWidget widget = new VirtualWikiWidget(
38: new MockWidgetRoot(), text);
39: String html = widget.render();
40: assertHasRegexp("deprecated", html);
41: }
42:
43: protected String getRegexp() {
44: return VirtualWikiWidget.REGEXP;
45: }
46: }
|