Update of /var/cvs/tests/util/org/mmbase/util In directory james.mmbase.org:/tmp/cvs-serv2166
Modified Files: LocalizedStringTest.java Log Message: Test case for setKey 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.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- LocalizedStringTest.java 28 Apr 2009 06:30:32 -0000 1.4 +++ LocalizedStringTest.java 28 Apr 2009 06:52:50 -0000 1.5 @@ -18,7 +18,7 @@ /** * * @author Michiel Meeuwissen - * @verion $Id: LocalizedStringTest.java,v 1.4 2009/04/28 06:30:32 michiel Exp $ + * @verion $Id: LocalizedStringTest.java,v 1.5 2009/04/28 06:52:50 michiel Exp $ */ public class LocalizedStringTest extends TestCase { @@ -141,6 +141,54 @@ assertFalse(clone.equals(rol)); } + public void testSetKey() { + LocalizedString l = getInstance(); + LocalizedString rol = new ReadonlyLocalizedString(l); + LocalizedString clone = l.clone(); + + assertEquals("funny", l.getKey()); + assertEquals("funny", rol.getKey()); + assertEquals("funny", clone.getKey()); + + clone.setKey("fun"); + assertEquals("funny", l.getKey()); + assertEquals("funny", rol.getKey()); + assertEquals("fun", clone.getKey()); + assertEquals("funny", l.get(DK)); + assertEquals("funny", l.get(null)); + assertEquals("funny", rol.get(DK)); + assertEquals("funny", rol.get(null)); + assertEquals("fun", clone.get(DK)); + assertEquals("fun", clone.get(null)); + + try { + rol.setKey("nuf"); + fail(); + } catch (IllegalStateException ise) { + } + assertEquals("funny", l.getKey()); + assertEquals("funny", rol.getKey()); + assertEquals("fun", clone.getKey()); + assertEquals("funny", l.get(DK)); + assertEquals("funny", l.get(null)); + assertEquals("funny", rol.get(DK)); + assertEquals("funny", rol.get(null)); + assertEquals("fun", clone.get(DK)); + assertEquals("fun", clone.get(null)); + + l.setKey("nuf"); + + assertEquals("nuf", l.getKey()); + assertEquals("nuf", rol.getKey()); + assertEquals("fun", clone.getKey()); + assertEquals("nuf", l.get(DK)); + assertEquals("nuf", l.get(null)); + assertEquals("nuf", rol.get(DK)); + assertEquals("nuf", rol.get(null)); + assertEquals("fun", clone.get(DK)); + assertEquals("fun", clone.get(null)); + } + } _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs