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.updates;
04:
05: import java.io.File;
06:
07: public class FileUpdateTest extends AbstractUpdateTestCase {
08: public final File testFile = new File("target/classes/testFile");
09:
10: protected Update makeUpdate() throws Exception {
11: return new FileUpdate(updater, "testFile", "files/images");
12: }
13:
14: public void setUp() throws Exception {
15: super .setUp();
16: testFile.createNewFile();
17: }
18:
19: public void tearDown() throws Exception {
20: super .tearDown();
21: testFile.delete();
22: }
23:
24: public void testSimpleFunctions() throws Exception {
25: assertTrue("doesn't want to apply", update.shouldBeApplied());
26: assertTrue("wrong starting of message", update.getMessage()
27: .startsWith("Installing file: "));
28: assertTrue("wrong end of message", update.getMessage()
29: .endsWith("testFile"));
30: assertEquals("FileUpdate(testFile)", update.getName());
31: }
32:
33: public void XtestUpdateWithMissingDirectories() throws Exception {
34: // FIXME
35: update.doUpdate();
36:
37: File file = new File(context.rootPagePath
38: + "/files/images/testFile");
39: assertTrue(file.exists());
40:
41: assertFalse(update.shouldBeApplied());
42: }
43:
44: public void testFileMissing() throws Exception {
45: update = new FileUpdate(updater, "images/missingFile",
46: "files/images");
47:
48: try {
49: update.doUpdate();
50: fail();
51: } catch (Exception e) {
52: }
53: }
54: }
|