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.wiki;
04:
05: import junit.framework.*;
06:
07: public class MockingPageCrawlerTest extends TestCase {
08: private WikiPage root;
09:
10: private PageCrawler crawler;
11:
12: public void setUp() throws Exception {
13: root = InMemoryPage.makeRoot("RooT");
14: crawler = root.getPageCrawler();
15: crawler.setDeadEndStrategy(new MockingPageCrawler());
16: }
17:
18: public void tearDown() throws Exception {
19: }
20:
21: public void testGetMockPageSimple() throws Exception {
22: WikiPagePath pageOnePath = PathParser.parse("PageOne");
23: WikiPage mockPage = crawler.getPage(root, pageOnePath);
24: assertNotNull(mockPage);
25: assertTrue(mockPage instanceof MockWikiPage);
26: assertEquals("PageOne", mockPage.getName());
27: }
28:
29: public void testGetMockPageMoreComplex() throws Exception {
30: WikiPagePath otherPagePath = PathParser
31: .parse("PageOne.SomePage.OtherPage");
32: WikiPage mockPage = crawler.getPage(root, otherPagePath);
33: assertNotNull(mockPage);
34: assertTrue(mockPage instanceof MockWikiPage);
35: assertEquals("OtherPage", mockPage.getName());
36: }
37: }
|