git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bundle: some fixes + update tests
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
utils
/
test
/
BundleTest.java
diff --git
a/src/be/nikiroo/utils/test/BundleTest.java
b/src/be/nikiroo/utils/test/BundleTest.java
index 4b9ac7dd81ed2adec96876104bd0e960c99536c6..a881817239fb8644c9e3a12e476561b97e1f9736 100644
(file)
--- 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 {
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 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);
b.reload(false);
- assertEquals("We should not have a bundle to load",
- null, def);
assertEquals("We should have reloaded the same files",
assertEquals("We should have reloaded the same files",
-
now
, b.getString(E.ONE));
+
val
, b.getString(E.ONE));
// reset values for next tests
// 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
assertEquals(val, setGet);
// reset values for next tests
- b.restore
Changes
(null);
+ b.restore
Snapshot
(null);
}
});
}
});
@@
-88,19
+94,19
@@
class BundleTest extends TestLauncher {
String def = b.getString(E.ONE);
b.setString(E.ONE, val);
String def = b.getString(E.ONE);
b.setString(E.ONE, val);
- Object snap = b.take
Changes
Snapshot();
+ Object snap = b.takeSnapshot();
- b.restore
Changes
(null);
+ b.restore
Snapshot
(null);
assertEquals(
"restoreChanges(null) should clear the changes",
def, b.getString(E.ONE));
assertEquals(
"restoreChanges(null) should clear the changes",
def, b.getString(E.ONE));
- b.restore
Changes
(snap);
+ b.restore
Snapshot
(snap);
assertEquals(
"restoreChanges(snapshot) should restore the changes",
val, b.getString(E.ONE));
// reset values for next tests
assertEquals(
"restoreChanges(snapshot) should restore the changes",
val, b.getString(E.ONE));
// reset values for next tests
- b.restore
Changes
(null);
+ b.restore
Snapshot
(null);
}
});
}
});
@@
-203,14
+209,14
@@
class BundleTest extends TestLauncher {
@Override
// ...and make it public
@Override
// ...and make it public
- public Object take
Changes
Snapshot() {
- return super.take
Changes
Snapshot();
+ public Object takeSnapshot() {
+ return super.takeSnapshot();
}
@Override
// ...and make it public
}
@Override
// ...and make it public
- public void restore
Changes
(Object snap) {
- super.restore
Changes
(snap);
+ public void restore
Snapshot
(Object snap) {
+ super.restore
Snapshot
(snap);
}
}
}
}