01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.config.schema.dynamic;
05:
06: import com.tc.config.schema.MockXmlObject;
07:
08: import java.io.File;
09:
10: /**
11: * Unit test for {@link FileXPathBasedConfigItem}.
12: */
13: public class FileXPathBasedConfigItemTest extends
14: XPathBasedConfigItemTestBase {
15:
16: private class SubBean extends MockXmlObject {
17: public String getStringValue() {
18: return currentValue;
19: }
20: }
21:
22: private String currentValue;
23:
24: protected MockXmlObject createSubBean() throws Exception {
25: return new SubBean();
26: }
27:
28: protected void setUp() throws Exception {
29: super .setUp();
30:
31: this .currentValue = "foobar";
32: }
33:
34: public void testAll() throws Exception {
35: FileXPathBasedConfigItem withoutDefault = new FileXPathBasedConfigItem(
36: context, xpath);
37:
38: assertEquals(new File("foobar"), withoutDefault.getFile());
39: assertEquals(new File("foobar"), withoutDefault.getObject());
40:
41: this .currentValue = null;
42: withoutDefault = new FileXPathBasedConfigItem(context, xpath);
43: assertNull(withoutDefault.getFile());
44: assertNull(withoutDefault.getObject());
45: }
46:
47: }
|