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.responders.files;
04:
05: import fitnesse.testutil.AbstractRegex;
06: import fitnesse.*;
07: import fitnesse.http.*;
08:
09: public class RenameFileConfirmationResponderTest extends AbstractRegex {
10: MockRequest request;
11:
12: private FitNesseContext context;
13:
14: private String content;
15:
16: private SimpleResponse response;
17:
18: private Responder responder;
19:
20: public void setUp() throws Exception {
21: request = new MockRequest();
22: context = new FitNesseContext();
23: context.rootPagePath = SampleFileUtility.TEMP_TEST_DIR;
24: SampleFileUtility.makeSampleFiles();
25: }
26:
27: public void testContentOfPage() throws Exception {
28: getContentForSimpleRename();
29:
30: assertSubString("renameFile", content);
31: assertSubString("Rename File", content);
32: assertSubString("Rename <b>MyFile.txt</b>", content);
33: }
34:
35: public void testExistingFilenameIsInTextField() throws Exception {
36: getContentForSimpleRename();
37:
38: assertSubString(
39: "<input type=\"text\" name=\"newName\" value=\"MyFile.txt\"/>",
40: content);
41: }
42:
43: private void getContentForSimpleRename() throws Exception {
44: request.setResource("files");
45: request.addInput("filename", "MyFile.txt");
46: responder = new RenameFileConfirmationResponder();
47: response = (SimpleResponse) responder.makeResponse(context,
48: request);
49: content = response.getContent();
50: }
51:
52: public void testFitnesseLook() throws Exception {
53: Responder responder = new RenameFileConfirmationResponder();
54: SimpleResponse response = (SimpleResponse) responder
55: .makeResponse(context, request);
56: String content = response.getContent();
57: assertSubString(
58: "<link rel=\"stylesheet\" type=\"text/css\" href=\"/files/css/fitnesse.css\" media=\"screen\"/>",
59: content);
60: }
61:
62: }
|