X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Ftest%2FBundleTest.java;h=c1c379f833bd0e114a54e367151b27a235217138;hb=79961c53a472a86ee151a35149c27cc1617eb779;hp=4b9ac7dd81ed2adec96876104bd0e960c99536c6;hpb=e9ca6bb892b5358a273807bff834945ffe7b0cee;p=fanfix.git diff --git a/src/be/nikiroo/utils/test/BundleTest.java b/src/be/nikiroo/utils/test/BundleTest.java index 4b9ac7d..c1c379f 100644 --- a/src/be/nikiroo/utils/test/BundleTest.java +++ b/src/be/nikiroo/utils/test/BundleTest.java @@ -52,18 +52,24 @@ class BundleTest extends TestLauncher { addTest(new TestCase("Reload") { @Override public void test() throws Exception { - String now = b.getString(E.ONE); - b.reload(true); String def = b.getString(E.ONE); + String val = "Something"; + + b.setString(E.ONE, val); + b.updateFile(); + b.reload(true); + + assertEquals("We should have reset the bundle", def, + b.getString(E.ONE)); + b.reload(false); - assertEquals("We should not have a bundle to load", - null, def); assertEquals("We should have reloaded the same files", - now, b.getString(E.ONE)); + val, b.getString(E.ONE)); // reset values for next tests - b.reload(false); + b.reload(true); + b.updateFile(); } }); @@ -77,7 +83,7 @@ class BundleTest extends TestLauncher { assertEquals(val, setGet); // reset values for next tests - b.restoreChanges(null); + b.restoreSnapshot(null); } }); @@ -88,19 +94,19 @@ class BundleTest extends TestLauncher { String def = b.getString(E.ONE); b.setString(E.ONE, val); - Object snap = b.takeChangesSnapshot(); + Object snap = b.takeSnapshot(); - b.restoreChanges(null); + b.restoreSnapshot(null); assertEquals( "restoreChanges(null) should clear the changes", def, b.getString(E.ONE)); - b.restoreChanges(snap); + b.restoreSnapshot(snap); assertEquals( "restoreChanges(snapshot) should restore the changes", val, b.getString(E.ONE)); // reset values for next tests - b.restoreChanges(null); + b.restoreSnapshot(null); } }); @@ -198,19 +204,19 @@ class BundleTest extends TestLauncher { */ private class B extends Bundle { protected B() { - super(E.class, N.bundle_test); + super(E.class, N.bundle_test, null); } @Override // ...and make it public - public Object takeChangesSnapshot() { - return super.takeChangesSnapshot(); + public Object takeSnapshot() { + return super.takeSnapshot(); } @Override // ...and make it public - public void restoreChanges(Object snap) { - super.restoreChanges(snap); + public void restoreSnapshot(Object snap) { + super.restoreSnapshot(snap); } } @@ -220,13 +226,13 @@ class BundleTest extends TestLauncher { * @author niki */ private enum E { - @Meta(what = "", where = "", format = "", info = "") + @Meta ONE, // - @Meta(what = "", where = "", format = "", info = "") + @Meta ONE_SUFFIX, // - @Meta(what = "", where = "", format = "", info = "") + @Meta TWO, // - @Meta(what = "", where = "", format = "", info = "") + @Meta JAPANESE }