From 43e57a42832ea8b4ceb0317f3c9028a4174ffa7b Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 8 Aug 2007 07:25:32 +0000 Subject: Adapted project directory structure to suit the new maven based build process. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@909 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../gv/egovernment/moa/util/DateTimeUtilsTest.java | 104 --------------------- 1 file changed, 104 deletions(-) delete mode 100644 common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java (limited to 'common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java') diff --git a/common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java b/common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java deleted file mode 100644 index da6b29b1c..000000000 --- a/common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java +++ /dev/null @@ -1,104 +0,0 @@ -package test.at.gv.egovernment.moa.util; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -import junit.framework.TestCase; - -import at.gv.egovernment.moa.util.DateTimeUtils; - -/** - * @author Patrick Peck - * @version $Id$ - */ -public class DateTimeUtilsTest extends TestCase { - - /** - * Constructor for DateTimeUtilsTest. - * @param arg0 - */ - public DateTimeUtilsTest(String arg0) { - super(arg0); - } - - public void testParseDateTimeValid() throws Exception { - Date date; - DateFormat format = SimpleDateFormat.getDateTimeInstance(); - String dateStr; - - format.setTimeZone(TimeZone.getTimeZone("GMT")); - date = DateTimeUtils.parseDateTime("+1971-12-12T06:30:15"); - date.setTime(date.getTime() + TimeZone.getDefault().getRawOffset()); - dateStr = format.format(date); - assertEquals("12.12.1971 06:30:15", dateStr); - - date = DateTimeUtils.parseDateTime("2000-01-01T23:59:59.012Z"); - dateStr = format.format(date); - assertEquals("01.01.2000 23:59:59", dateStr); - - date = DateTimeUtils.parseDateTime("2003-05-20T12:17:30-05:00"); - dateStr = format.format(date); - assertEquals("20.05.2003 17:17:30", dateStr); - - - date = DateTimeUtils.parseDateTime("2002-02-02T02:02:02.33+04:30"); - dateStr = format.format(date); - assertEquals("01.02.2002 21:32:02", dateStr); - } - - public void testParseDateTimeInvalid() { - try { - DateTimeUtils.parseDateTime("+1971-12-12T6:30:15"); - fail(); - } catch (ParseException e) { - } - - try { - DateTimeUtils.parseDateTime("2000-01-0123:59:59.999999Z"); - fail(); - } catch (ParseException e) { - } - - try { - DateTimeUtils.parseDateTime("2003-05-20T12:17:3005:00"); - fail(); - } catch (ParseException e) { - } - - try { - DateTimeUtils.parseDateTime(" 2002-02-02T02:02:02.33+04:00"); - fail(); - } catch (ParseException e) { - } - - } - - public void testBuildDateTimeGMTMinus3() { - String should = "2002-01-01T01:01:01-03:00"; - doTestBuildDateTime(2002, 1, 1, 1, 1, 1, "GMT-03:00", should); - } - public void testBuildDateTimeMEZSommerzeit() { - String should = "2002-07-31T23:59:59+02:00"; - doTestBuildDateTime(2002, 7, 31, 23, 59, 59, "GMT+01:00", should); - } - public void testBuildDateTimeGMT() { - String should = "2002-01-01T01:01:01"; - doTestBuildDateTime(2002, 1, 1, 1, 1, 1, "GMT+00:00", should); - } - private void doTestBuildDateTime( - int year, int month, int day, - int hour, int min, int sec, - String timeZone, String dateTimeShould) { - - Calendar cal = new GregorianCalendar(TimeZone.getTimeZone(timeZone)); - cal.set(year,month, day, hour, min, sec); - cal.set(Calendar.MILLISECOND, 0); - String dateTimeBuilt = DateTimeUtils.buildDateTime(cal); - assertEquals(dateTimeShould, dateTimeBuilt); - } - -} -- cgit v1.2.3