KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > config > schema > dynamic > FileXPathBasedConfigItemTest


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.config.schema.dynamic;
5
6 import com.tc.config.schema.MockXmlObject;
7
8 import java.io.File JavaDoc;
9
10 /**
11  * Unit test for {@link FileXPathBasedConfigItem}.
12  */

13 public class FileXPathBasedConfigItemTest extends XPathBasedConfigItemTestBase {
14
15   private class SubBean extends MockXmlObject {
16     public String JavaDoc getStringValue() {
17       return currentValue;
18     }
19   }
20   
21   private String JavaDoc currentValue;
22
23   protected MockXmlObject createSubBean() throws Exception JavaDoc {
24     return new SubBean();
25   }
26
27   protected void setUp() throws Exception JavaDoc {
28     super.setUp();
29     
30     this.currentValue = "foobar";
31   }
32   
33   public void testAll() throws Exception JavaDoc {
34     FileXPathBasedConfigItem withoutDefault = new FileXPathBasedConfigItem(context, xpath);
35     
36     assertEquals(new File JavaDoc("foobar"), withoutDefault.getFile());
37     assertEquals(new File JavaDoc("foobar"), withoutDefault.getObject());
38     
39     this.currentValue = null;
40     withoutDefault = new FileXPathBasedConfigItem(context, xpath);
41     assertNull(withoutDefault.getFile());
42     assertNull(withoutDefault.getObject());
43   }
44   
45 }
46
Popular Tags