ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doo...@apache.org
Subject svn commit: r910354 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/conversion/test/DateTimeTests.java src/org/ofbiz/base/test/BaseUnitTests.java testdef/basetests.xml
Date Mon, 15 Feb 2010 22:23:56 GMT
Author: doogie
Date: Mon Feb 15 22:23:55 2010
New Revision: 910354

URL: http://svn.apache.org/viewvc?rev=910354&view=rev
Log:
Move DateTime conversion tests to separate class.

Added:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/test/DateTimeTests.java
Modified:
    ofbiz/trunk/framework/base/build.xml
    ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java
    ofbiz/trunk/framework/base/testdef/basetests.xml

Modified: ofbiz/trunk/framework/base/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/build.xml?rev=910354&r1=910353&r2=910354&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/build.xml (original)
+++ ofbiz/trunk/framework/base/build.xml Mon Feb 15 22:23:55 2010
@@ -40,6 +40,7 @@
     <filelist id="test.classes" dir="${src.dir}">
         <file name="org/ofbiz/base/util/test/IndentingWriterTests.java"/>
         <file name="org/ofbiz/base/json/test/JSONTests.java"/>
+        <file name="org/ofbiz/base/conversion/test/DateTimeTests.java"/>
         <file name="org/ofbiz/base/conversion/test/MiscTests.java"/>
         <file name="org/ofbiz/base/util/test/UtilIOTests.java"/>
         <file name="org/ofbiz/base/test/BaseUnitTests.java"/>

Added: ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/test/DateTimeTests.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/test/DateTimeTests.java?rev=910354&view=auto
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/test/DateTimeTests.java (added)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/test/DateTimeTests.java Mon Feb
15 22:23:55 2010
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.base.conversion.test;
+
+import org.ofbiz.base.conversion.Converter;
+import org.ofbiz.base.conversion.DateTimeConverters;
+import org.ofbiz.base.test.GenericTestCaseBase;
+
+public class DateTimeTests extends GenericTestCaseBase {
+
+    public DateTimeTests(String name) {
+        super(name);
+    }
+
+    public void testDateTimeConverters() throws Exception {
+        // Source class = java.util.Date
+        java.util.Date utilDate = new java.util.Date();
+        long dateMillis = utilDate.getTime();
+        Converter<java.util.Date, Long> dateToLong = new DateTimeConverters.DateToLong();
+        {
+            Long target = dateToLong.convert(utilDate);
+            assertEquals("DateToLong", dateMillis, target.longValue());
+        }
+        Converter<java.util.Date, java.sql.Date> dateToSqlDate = new DateTimeConverters.DateToSqlDate();
+        {
+            java.sql.Date target = dateToSqlDate.convert(utilDate);
+            assertEquals("DateToSqlDate", dateMillis, target.getTime());
+        }
+        Converter<java.util.Date, String> dateToString = new DateTimeConverters.DateToString();
+        {
+            String target = dateToString.convert(utilDate);
+            assertEquals("DateToString", utilDate.toString(), target);
+        }
+        Converter<java.util.Date, java.sql.Timestamp> dateToTimestamp = new DateTimeConverters.DateToTimestamp();
+        {
+            java.sql.Timestamp timestamp = dateToTimestamp.convert(utilDate);
+            assertEquals("DateToTimestamp", dateMillis, timestamp.getTime());
+        }
+        // Source class = java.sql.Date
+        java.sql.Date sqlDate = new java.sql.Date(System.currentTimeMillis());
+        Converter<java.sql.Date, java.util.Date> sqlDateToDate = new DateTimeConverters.SqlDateToDate();
+        {
+            java.util.Date target = sqlDateToDate.convert(sqlDate);
+            assertEquals("SqlDateToDate", sqlDate.getTime(), target.getTime());
+        }
+        Converter<java.sql.Date, String> sqlDateToString = new DateTimeConverters.SqlDateToString();
+        {
+            String target = sqlDateToString.convert(sqlDate);
+            assertEquals("SqlDateToString", sqlDate.toString(), target);
+        }
+        Converter<java.sql.Date, java.sql.Timestamp> sqlDateToTimestamp = new DateTimeConverters.SqlDateToTimestamp();
+        {
+            java.sql.Timestamp target = sqlDateToTimestamp.convert(sqlDate);
+            assertEquals("SqlDateToTimestamp", sqlDate.getTime(), target.getTime());
+        }
+    }
+}

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java?rev=910354&r1=910353&r2=910354&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java Mon Feb 15 22:23:55
2010
@@ -27,7 +27,6 @@
 
 import org.ofbiz.base.conversion.ConversionException;
 import org.ofbiz.base.conversion.Converter;
-import org.ofbiz.base.conversion.DateTimeConverters;
 import org.ofbiz.base.util.ComparableRange;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.StringUtil;
@@ -159,49 +158,6 @@
         assertTrue("UEL auto-vivify List " + fse.expandString(testMap), compare.equals(fse.expandString(testMap)));
     }
 
-    public void testDateTimeConverters() throws Exception {
-        // Source class = java.util.Date
-        java.util.Date utilDate = new java.util.Date();
-        long dateMillis = utilDate.getTime();
-        Converter<java.util.Date, Long> dateToLong = new DateTimeConverters.DateToLong();
-        {
-            Long target = dateToLong.convert(utilDate);
-            assertEquals("DateToLong", dateMillis, target.longValue());
-        }
-        Converter<java.util.Date, java.sql.Date> dateToSqlDate = new DateTimeConverters.DateToSqlDate();
-        {
-            java.sql.Date target = dateToSqlDate.convert(utilDate);
-            assertEquals("DateToSqlDate", dateMillis, target.getTime());
-        }
-        Converter<java.util.Date, String> dateToString = new DateTimeConverters.DateToString();
-        {
-            String target = dateToString.convert(utilDate);
-            assertEquals("DateToString", utilDate.toString(), target);
-        }
-        Converter<java.util.Date, java.sql.Timestamp> dateToTimestamp = new DateTimeConverters.DateToTimestamp();
-        {
-            java.sql.Timestamp timestamp = dateToTimestamp.convert(utilDate);
-            assertEquals("DateToTimestamp", dateMillis, timestamp.getTime());
-        }
-        // Source class = java.sql.Date
-        java.sql.Date sqlDate = new java.sql.Date(System.currentTimeMillis());
-        Converter<java.sql.Date, java.util.Date> sqlDateToDate = new DateTimeConverters.SqlDateToDate();
-        {
-            java.util.Date target = sqlDateToDate.convert(sqlDate);
-            assertEquals("SqlDateToDate", sqlDate.getTime(), target.getTime());
-        }
-        Converter<java.sql.Date, String> sqlDateToString = new DateTimeConverters.SqlDateToString();
-        {
-            String target = sqlDateToString.convert(sqlDate);
-            assertEquals("SqlDateToString", sqlDate.toString(), target);
-        }
-        Converter<java.sql.Date, java.sql.Timestamp> sqlDateToTimestamp = new DateTimeConverters.SqlDateToTimestamp();
-        {
-            java.sql.Timestamp target = sqlDateToTimestamp.convert(sqlDate);
-            assertEquals("SqlDateToTimestamp", sqlDate.getTime(), target.getTime());
-        }
-    }
-
     public void testStringUtil() {
         byte[] testArray = {-1};
         byte[] result = StringUtil.fromHexString(StringUtil.toHexString(testArray));

Modified: ofbiz/trunk/framework/base/testdef/basetests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/testdef/basetests.xml?rev=910354&r1=910353&r2=910354&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/testdef/basetests.xml (original)
+++ ofbiz/trunk/framework/base/testdef/basetests.xml Mon Feb 15 22:23:55 2010
@@ -22,6 +22,7 @@
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
     <test-case case-name="basetests">
         <junit-test-suite class-name="org.ofbiz.base.util.test.IndentingWriterTests"/>
+        <junit-test-suite class-name="org.ofbiz.base.conversion.test.DateTimeTests.java"/>
         <junit-test-suite class-name="org.ofbiz.base.conversion.test.MiscTests.java"/>
         <junit-test-suite class-name="org.ofbiz.base.util.test.UtilIOTests"/>
         <junit-test-suite class-name="org.ofbiz.base.test.BaseUnitTests"/>



Mime
View raw message