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
Update to version 1.5.0 (breaking Bundle/Meta)
[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..c1c379f833bd0e114a54e367151b27a235217138 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);
}
});
}
});
@@
-198,19
+204,19
@@
class BundleTest extends TestLauncher {
*/
private class B extends Bundle<E> {
protected B() {
*/
private class B extends Bundle<E> {
protected B() {
- super(E.class, N.bundle_test);
+ super(E.class, N.bundle_test
, null
);
}
@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);
}
}
}
}
@@
-220,13
+226,13
@@
class BundleTest extends TestLauncher {
* @author niki
*/
private enum E {
* @author niki
*/
private enum E {
- @Meta
(what = "", where = "", format = "", info = "")
+ @Meta
ONE, //
ONE, //
- @Meta
(what = "", where = "", format = "", info = "")
+ @Meta
ONE_SUFFIX, //
ONE_SUFFIX, //
- @Meta
(what = "", where = "", format = "", info = "")
+ @Meta
TWO, //
TWO, //
- @Meta
(what = "", where = "", format = "", info = "")
+ @Meta
JAPANESE
}
JAPANESE
}