Skip to content
Permalink
Browse files

Improved: Turn ‘DateTimeTests’ into a unit test class

(OFBIZ-11067)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859977 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed May 25, 2019
1 parent 2a4a9ba commit 1103a2a3e1d6be32b17ce3d3ff8de44d609d89b7
@@ -1,4 +1,4 @@
/*******************************************************************************
/*
* 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
@@ -15,28 +15,27 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.apache.ofbiz.base.conversion.test;
*/
package org.apache.ofbiz.base.conversion;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;

import org.apache.ofbiz.base.conversion.Converter;
import org.apache.ofbiz.base.conversion.DateTimeConverters;
import org.apache.ofbiz.base.lang.SourceMonitored;
import org.apache.ofbiz.base.test.GenericTestCaseBase;
import org.junit.Test;

import com.ibm.icu.util.Calendar;

@SourceMonitored
public class DateTimeTests extends GenericTestCaseBase {

public DateTimeTests(String name) {
super(name);
}
public class DateTimeTests {

public static <S, T> void assertConversion(String label, Converter<S, T> converter, S source, T target) throws Exception {
private static <S, T> void assertConversion(String label, Converter<S, T> converter, S source, T target) throws Exception {
assertTrue(label + " can convert", converter.canConvert(source.getClass(), target.getClass()));
assertEquals(label + " converted", target, converter.convert(source));
}

@Test
public void testDateTimeConverters() throws Exception {
Calendar cal = Calendar.getInstance();
long currentTime = cal.getTimeInMillis();
@@ -34,7 +34,6 @@
<junit-test-suite class-name="org.apache.ofbiz.base.util.collections.test.FlexibleMapAccessorTests"/>
<junit-test-suite class-name="org.apache.ofbiz.base.util.test.TimeDurationTests"/>
<junit-test-suite class-name="org.apache.ofbiz.base.util.cache.test.UtilCacheTests"/>
<junit-test-suite class-name="org.apache.ofbiz.base.conversion.test.DateTimeTests"/>
<junit-test-suite class-name="org.apache.ofbiz.base.conversion.test.MiscTests"/>
<junit-test-suite class-name="org.apache.ofbiz.base.conversion.test.TestBooleanConverters"/>
<junit-test-suite class-name="org.apache.ofbiz.base.conversion.test.TestJSONConverters"/>

0 comments on commit 1103a2a

Please sign in to comment.
You can’t perform that action at this time.