Update of /var/cvs/tests/util/org/mmbase/util
In directory james.mmbase.org:/tmp/cvs-serv1675
Modified Files:
LocalizedStringTest.java
Log Message:
Some testing of clone and serializable of 'readonly' localized strings
See also: http://cvs.mmbase.org/viewcvs/tests/util/org/mmbase/util
Index: LocalizedStringTest.java
===================================================================
RCS file: /var/cvs/tests/util/org/mmbase/util/LocalizedStringTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- LocalizedStringTest.java 27 Apr 2009 17:20:02 -0000 1.3
+++ LocalizedStringTest.java 28 Apr 2009 06:30:32 -0000 1.4
@@ -18,7 +18,7 @@
/**
*
* @author Michiel Meeuwissen
- * @verion $Id: LocalizedStringTest.java,v 1.3 2009/04/27 17:20:02 michiel Exp
$
+ * @verion $Id: LocalizedStringTest.java,v 1.4 2009/04/28 06:30:32 michiel Exp
$
*/
public class LocalizedStringTest extends TestCase {
@@ -68,7 +68,6 @@
}
-
public void testSerializable() throws IOException,
java.lang.ClassNotFoundException {
LocalizedString l = getInstance();
@@ -86,6 +85,22 @@
assertEquals(l, dl);
}
+ public void testReadonlySerializable() throws IOException,
java.lang.ClassNotFoundException {
+ LocalizedString rol = new ReadonlyLocalizedString(getInstance());
+ // serialize
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(out);
+ oos.writeObject(rol);
+ oos.close();
+
+
+ //deserialize
+ InputStream in = new ByteArrayInputStream(out.toByteArray());
+ ObjectInputStream ois = new ObjectInputStream(in);
+ LocalizedString drol = (LocalizedString) ois.readObject();
+
+ assertEquals(rol, drol);
+ }
public void testMakeReadOnly() {
LocalizedString l = getInstance();
@@ -105,6 +120,27 @@
assertEquals(l, rol);
}
+ public void testMakeReadOnlyClone() {
+ LocalizedString rol = new ReadonlyLocalizedString(getInstance());
+ LocalizedString clone = rol.clone();
+
+ assertEquals(rol, clone);
+
+ try {
+ rol.set("plezzant", BE_VAR);
+ fail();
+ } catch (IllegalStateException ise) {
+ }
+ assertEquals(rol, clone);
+ assertEquals(clone, rol);
+
+ // a clone is not read only any more
+ clone.set("plezzant", BE_VAR);
+
+ assertFalse(rol.equals(clone));
+ assertFalse(clone.equals(rol));
+ }
+
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs