@Test public void testFailOnMismatch() throws Exception { ConfigClasspathStore fs = ConfigClasspathStore.create().build(); assertNotNull(fs.write("X.cfg", "xxx", "foo")); assertEquals("", fs.read("X.cfg")); assertNull(fs.write("X.cfg", null, "foo")); assertEquals("foo", fs.read("X.cfg")); assertNotNull(fs.write("X.cfg", "xxx", "foo")); assertEquals("foo", fs.read("X.cfg")); assertNull(fs.write("X.cfg", "foo", "bar")); assertEquals("bar", fs.read("X.cfg")); }
@Test public void testExists() throws Exception { ConfigClasspathStore.DEFAULT.write("foo.cfg", null, "foo"); assertTrue(ConfigClasspathStore.DEFAULT.exists("foo.cfg")); assertFalse(ConfigClasspathStore.DEFAULT.exists("foo2.cfg")); ConfigClasspathStore.DEFAULT.write("foo.cfg", "foo", null); assertFalse(ConfigClasspathStore.DEFAULT.exists("foo.cfg")); assertFalse(ConfigClasspathStore.DEFAULT.exists("foo2.cfg")); } }
@Test public void testSimpleCreate() throws Exception { ConfigClasspathStore fs = ConfigClasspathStore.create().build(); assertNull(fs.write("X.cfg", null, "foo")); assertEquals("foo", fs.read("X.cfg")); }
@Test public void testOverwriteRealFiles() throws Exception { ConfigClasspathStore fs = ConfigClasspathStore.create().build(); assertContains(fs.read("foo1.cfg"), "bar1"); fs.write("foo1.cfg", fs.read("foo1.cfg"), "xxx"); assertEquals("xxx", fs.read("foo1.cfg")); }