Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.lang.time
Class DateUtilsTest  view DateUtilsTest download DateUtilsTest.java

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.commons.lang.time.DateUtilsTest
All Implemented Interfaces:
junit.framework.Test

public class DateUtilsTest
extends junit.framework.TestCase

Unit tests DateUtils.


Field Summary
(package private)  java.util.Calendar cal1
           
(package private)  java.util.Calendar cal2
           
(package private)  java.util.Calendar cal3
           
(package private)  java.util.Calendar cal4
           
(package private)  java.util.Calendar cal5
           
(package private)  java.util.Calendar cal6
           
(package private)  java.util.Calendar cal7
           
(package private)  java.util.Calendar cal8
           
(package private)  java.util.Calendar calAmPm1
           
(package private)  java.util.Calendar calAmPm2
           
(package private)  java.util.Calendar calAmPm3
           
(package private)  java.util.Calendar calAmPm4
           
(package private)  java.util.Date date0
           
(package private)  java.util.Date date1
           
(package private)  java.util.Date date2
           
(package private)  java.util.Date date3
           
(package private)  java.util.Date date4
           
(package private)  java.util.Date date5
           
(package private)  java.util.Date date6
           
(package private)  java.util.Date date7
           
(package private)  java.util.Date date8
           
(package private)  java.util.Date dateAmPm1
           
(package private)  java.util.Date dateAmPm2
           
(package private)  java.util.Date dateAmPm3
           
(package private)  java.util.Date dateAmPm4
           
(package private)  java.text.DateFormat dateParser
           
(package private)  java.text.DateFormat dateTimeParser
           
(package private)  java.util.TimeZone defaultZone
           
(package private)  java.text.DateFormat timeZoneDateParser
           
(package private)  java.util.TimeZone zone
           
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
DateUtilsTest(java.lang.String name)
           
 
Method Summary
private static void assertEquals(java.lang.String message, java.util.Calendar cal1, java.util.Calendar cal2, long delta)
          Used to check that Calendar objects are close enough delta is in milliseconds
private static void assertWeekIterator(java.util.Iterator it, java.util.Calendar start)
          This checks that this is a 7 element iterator of Calendar objects that are dates (no time), and exactly 1 day spaced after each other.
private static void assertWeekIterator(java.util.Iterator it, java.util.Calendar start, java.util.Calendar end)
          This checks that this is a 7 divisble iterator of Calendar objects that are dates (no time), and exactly 1 day spaced after each other (in addition to the proper start and stop dates)
private static void assertWeekIterator(java.util.Iterator it, java.util.Date start, java.util.Date end)
          Convenience method for when working with Date objects
static void main(java.lang.String[] args)
           
protected  void setUp()
          Sets up the fixture, for example, open a network connection.
static junit.framework.Test suite()
           
protected  void tearDown()
          Tears down the fixture, for example, close a network connection.
 void testConstructor()
           
 void testIsSameDay_Cal()
           
 void testIsSameDay_Date()
           
 void testIsSameInstant_Cal()
           
 void testIsSameInstant_Date()
           
 void testIsSameLocalTime_Cal()
           
 void testIteratorEx()
          Tests the iterator exceptions
 void testMonthIterator()
          Tests the calendar iterator for month-based ranges
 void testParseDate()
           
 void testRound()
          Tests various values with the round method
 void testTruncate()
          Tests various values with the trunc method
 void testWeekIterator()
          Tests the calendar iterator for week ranges
(package private)  void warn(java.lang.String msg)
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dateParser

java.text.DateFormat dateParser

dateTimeParser

java.text.DateFormat dateTimeParser

timeZoneDateParser

java.text.DateFormat timeZoneDateParser

dateAmPm1

java.util.Date dateAmPm1

dateAmPm2

java.util.Date dateAmPm2

dateAmPm3

java.util.Date dateAmPm3

dateAmPm4

java.util.Date dateAmPm4

date0

java.util.Date date0

date1

java.util.Date date1

date2

java.util.Date date2

date3

java.util.Date date3

date4

java.util.Date date4

date5

java.util.Date date5

date6

java.util.Date date6

date7

java.util.Date date7

date8

java.util.Date date8

calAmPm1

java.util.Calendar calAmPm1

calAmPm2

java.util.Calendar calAmPm2

calAmPm3

java.util.Calendar calAmPm3

calAmPm4

java.util.Calendar calAmPm4

cal1

java.util.Calendar cal1

cal2

java.util.Calendar cal2

cal3

java.util.Calendar cal3

cal4

java.util.Calendar cal4

cal5

java.util.Calendar cal5

cal6

java.util.Calendar cal6

cal7

java.util.Calendar cal7

cal8

java.util.Calendar cal8

zone

java.util.TimeZone zone

defaultZone

java.util.TimeZone defaultZone
Constructor Detail

DateUtilsTest

public DateUtilsTest(java.lang.String name)
Method Detail

main

public static void main(java.lang.String[] args)

suite

public static junit.framework.Test suite()

setUp

protected void setUp()
              throws java.lang.Exception
Description copied from class: junit.framework.TestCase
Sets up the fixture, for example, open a network connection. This method is called before a test is executed.


tearDown

protected void tearDown()
                 throws java.lang.Exception
Description copied from class: junit.framework.TestCase
Tears down the fixture, for example, close a network connection. This method is called after a test is executed.


testConstructor

public void testConstructor()

testIsSameDay_Date

public void testIsSameDay_Date()

testIsSameDay_Cal

public void testIsSameDay_Cal()

testIsSameInstant_Date

public void testIsSameInstant_Date()

testIsSameInstant_Cal

public void testIsSameInstant_Cal()

testIsSameLocalTime_Cal

public void testIsSameLocalTime_Cal()

testParseDate

public void testParseDate()
                   throws java.lang.Exception

testRound

public void testRound()
               throws java.lang.Exception
Tests various values with the round method


testTruncate

public void testTruncate()
                  throws java.lang.Exception
Tests various values with the trunc method


testIteratorEx

public void testIteratorEx()
                    throws java.lang.Exception
Tests the iterator exceptions


testWeekIterator

public void testWeekIterator()
                      throws java.lang.Exception
Tests the calendar iterator for week ranges


testMonthIterator

public void testMonthIterator()
                       throws java.lang.Exception
Tests the calendar iterator for month-based ranges


assertWeekIterator

private static void assertWeekIterator(java.util.Iterator it,
                                       java.util.Calendar start)
This checks that this is a 7 element iterator of Calendar objects that are dates (no time), and exactly 1 day spaced after each other.


assertWeekIterator

private static void assertWeekIterator(java.util.Iterator it,
                                       java.util.Date start,
                                       java.util.Date end)
Convenience method for when working with Date objects


assertWeekIterator

private static void assertWeekIterator(java.util.Iterator it,
                                       java.util.Calendar start,
                                       java.util.Calendar end)
This checks that this is a 7 divisble iterator of Calendar objects that are dates (no time), and exactly 1 day spaced after each other (in addition to the proper start and stop dates)


assertEquals

private static void assertEquals(java.lang.String message,
                                 java.util.Calendar cal1,
                                 java.util.Calendar cal2,
                                 long delta)
Used to check that Calendar objects are close enough delta is in milliseconds


warn

void warn(java.lang.String msg)