Update of /var/cvs/tests/util/org/mmbase/util
In directory james.mmbase.org:/tmp/cvs-serv4486/org/mmbase/util
Modified Files:
CastingTest.java ResourceLoaderTest.java
Log Message:
more test cases
See also: http://cvs.mmbase.org/viewcvs/tests/util/org/mmbase/util
Index: CastingTest.java
===================================================================
RCS file: /var/cvs/tests/util/org/mmbase/util/CastingTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- CastingTest.java 23 Jul 2008 17:15:48 -0000 1.1
+++ CastingTest.java 12 Sep 2008 13:10:43 -0000 1.2
@@ -16,7 +16,7 @@
/**
*
* @author Michiel Meeuwissen
- * @verion $Id: CastingTest.java,v 1.1 2008/07/23 17:15:48 michiel Exp $
+ * @verion $Id: CastingTest.java,v 1.2 2008/09/12 13:10:43 michiel Exp $
*/
public class CastingTest extends TestCase {
@@ -37,6 +37,9 @@
public void testInt() {
assertEquals(1, Casting.toInt("1"));
assertEquals(-1, Casting.toInt("asdfasdf"));
+ assertEquals(-5, Casting.toInt("asdfasdf", -5));
+ assertEquals(-5, Casting.toInt(null, -5));
+
assertEquals(5, Casting.toInt("5.3"));
assertEquals(5, Casting.toInt("5.6"));
assertEquals(100, Casting.toInt("1e2"));
@@ -46,7 +49,23 @@
assertEquals(15, Casting.toInt("15", 8));
}
public void testInteger() {
- assertEquals(-1, (Object) Casting.toInteger(null));
+ assertEquals(new Integer(10), (Object) Casting.toInteger("10"));
+ assertEquals(new Integer(10), (Object) Casting.toInteger("1e1"));
+ assertEquals(new Integer(-1), (Object) Casting.toInteger(null));
+ }
+
+ public void testLong() {
+ assertEquals(new Long(10), (Object) Casting.toLong("10"));
+ assertEquals(new Long(10), (Object) Casting.toLong("1e1"));
+ assertEquals(new Long(-1), (Object) Casting.toLong(null));
+ }
+
+ public void testFloat() {
+ assertEquals(new Float(-1.0), (Object) Casting.toFloat(null));
+ }
+
+ public void testDouble() {
+ assertEquals(new Double(-1.0), (Object) Casting.toDouble(null));
}
Index: ResourceLoaderTest.java
===================================================================
RCS file: /var/cvs/tests/util/org/mmbase/util/ResourceLoaderTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- ResourceLoaderTest.java 3 Jun 2005 07:15:33 -0000 1.4
+++ ResourceLoaderTest.java 12 Sep 2008 13:10:43 -0000 1.5
@@ -21,7 +21,7 @@
* </ul>
*
* @author Kees Jongenburger
- * @verion $Id: ResourceLoaderTest.java,v 1.4 2005/06/03 07:15:33 michiel Exp $
+ * @verion $Id: ResourceLoaderTest.java,v 1.5 2008/09/12 13:10:43 michiel Exp $
*/
public class ResourceLoaderTest extends TestCase {
@@ -41,4 +41,15 @@
assertNotNull("did not find mmbaseroot.xml", url);
assertTrue("non existing resource should openable for input",
url.openConnection().getDoInput());
}
+
+ public void testGetPropertiesBuilder() throws java.io.IOException {
+ URL url =
ResourceLoader.getConfigurationRoot().getResource("builders/properties.xml");
+ assertNotNull("did not find properties.xml", url);
+ assertTrue("non existing resource should openable for input",
url.openConnection().getDoInput());
+ }
+ public void testGetPropertiesBuilder2() throws java.io.IOException {
+ URL url =
ResourceLoader.getConfigurationRoot().getChildResourceLoader("builders").getResource("properties.xml");
+ assertNotNull("did not find properties.xml", url);
+ assertTrue("non existing resource should openable for input",
url.openConnection().getDoInput());
+ }
}
\ No newline at end of file
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs