Author: michiel Date: 2009-08-17 11:47:08 +0200 (Mon, 17 Aug 2009) New Revision: 37932
Modified: mmbase/trunk/core/src/test/java/org/mmbase/datatypes/DataTypesTest.java Log: added test case for 'filesize' datatype Modified: mmbase/trunk/core/src/test/java/org/mmbase/datatypes/DataTypesTest.java =================================================================== --- mmbase/trunk/core/src/test/java/org/mmbase/datatypes/DataTypesTest.java 2009-08-17 09:38:30 UTC (rev 37931) +++ mmbase/trunk/core/src/test/java/org/mmbase/datatypes/DataTypesTest.java 2009-08-17 09:47:08 UTC (rev 37932) @@ -11,8 +11,9 @@ package org.mmbase.datatypes; import org.mmbase.datatypes.util.xml.*; -import java.util.Locale; +import java.util.*; import org.mmbase.bridge.Field; +import org.mmbase.bridge.dummy.*; import org.mmbase.util.LocalizedString; import org.mmbase.util.xml.DocumentReader; import org.mmbase.util.xml.XMLWriter; @@ -53,6 +54,11 @@ } @Test + public void testSetup(){ + assertEquals(new Locale("dk"), LocalizedString.getDefault()); + } + + @Test public void testName() { assertEquals("string", getString().getName()); assertEquals("clone", getStringClone().getName()); @@ -272,10 +278,30 @@ public void testXml7() throws Exception { //FAILS - // testXml("<datatype base='string'><description>bar</description><default value='bar' /><required value='true' /><unique value='true' /></datatype>", false); + testXml("<datatype base='string'><description>bar</description><default value='bar' /><required value='true' /><unique value='true' /></datatype>", false); } + @Test + public void filesize() throws Exception { + DataType<?> dt = DataTypes.getDataType("filesize"); + DummyCloudContext cc = new DummyCloudContext(); + Map<String, DataType> map = new HashMap<String, DataType>(); + map.put("filesize", dt); + cc.addNodeManager("testfilesize", map); + org.mmbase.bridge.Node n = cc.getCloud("mmbase").getNodeManager("testfilesize").createNode(); + n.setIntValue("filesize", 100); + n.commit(); + assertEquals(100, n.getIntValue("filesize")); + assertEquals("100 B", n.getStringValue("filesize")); + + } + + + + + + } _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs