org.joda.time.chrono.gj
Class MainTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.joda.time.chrono.gj.MainTest
All Implemented Interfaces:
junit.framework.Test

public class MainTest
extends junit.framework.TestCase

Tests either the Julian or Gregorian chronology from org.joda.time.chrono.gj against the implementations in this package. It tests all the date fields against their principal methods.

Randomly generated values are fed into the DateTimeField methods and the results are compared between the two chronologies. If any result doesn't match, an error report is generated and the program exits. Each time this test program is run, the pseudo random number generator is seeded with the same value. This ensures consistent results between test runs.

The main method accepts three optional arguments: iterations, mode, seed. By default, iterations is set to 1,000,000. The test will take several minutes to run, depending on the computer's performance. Every 5 seconds a progress message is printed.

The mode can be either 'g' for proleptic gregorian (the default) or 'j' for proleptic julian. To override the default random number generator seed, pass in a third argument which accepts a long signed integer.

Author:
Brian S O'Neill

Field Summary
static int GREGORIAN_MODE
           
static int JULIAN_MODE
           
 
Constructor Summary
MainTest(int iterations, int mode, long seed)
           
 
Method Summary
static void main(String[] args)
          Arguments: iterations [mode [seed]]
 void testChronology()
          Main junit test
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, 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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GREGORIAN_MODE

public static final int GREGORIAN_MODE
See Also:
Constant Field Values

JULIAN_MODE

public static final int JULIAN_MODE
See Also:
Constant Field Values
Constructor Detail

MainTest

public MainTest(int iterations,
                int mode,
                long seed)
Parameters:
iterations - number of test iterations to perform
mode - GREGORIAN_MODE or JULIAN_MODE,0=Gregorian, 1=Julian
seed - seed for random number generator
Method Detail

main

public static void main(String[] args)
                 throws Exception
Arguments: iterations [mode [seed]]

Throws:
Exception

testChronology

public void testChronology()
Main junit test



Copyright © 2002-2013 Joda.org. All Rights Reserved.