1 16 package test.types; 17 18 import junit.framework.TestCase; 19 import org.apache.axis.types.Duration; 20 21 public class TestDuration extends TestCase 22 { 23 24 public TestDuration( String name ) 25 { 26 super( name ); 27 } 28 29 30 public void testDurations() 31 throws Exception 32 { 33 String [] durationStrings = new String [ 11 ]; 35 durationStrings[ 0 ] = "P2Y3M8DT8H1M3.3S"; 36 durationStrings[ 1 ] = "P2Y3M8DT8H1M3S"; 37 durationStrings[ 2 ] = "PT8H1M3.3S"; 38 durationStrings[ 3 ] = "P2Y3M8D"; 39 durationStrings[ 4 ] = "P2YT8H"; 40 durationStrings[ 5 ] = "P8DT3.3S"; 41 durationStrings[ 6 ] = "P3MT1M"; 42 durationStrings[ 7 ] = "PT0.3S"; 43 durationStrings[ 8 ] = "P1M"; 44 durationStrings[ 9 ] = "-P1M"; 45 durationStrings[ 10 ] = "-P2Y3M8DT8H1M3.3S"; 46 47 for( int i = 0; i < durationStrings.length; i++ ) 48 { 49 String durationString = durationStrings[ i ]; 50 Duration duration = 51 new Duration( durationString ); 52 53 assertTrue( "Duration string \"" + durationString + 54 "\" not equal to returned: " + duration.toString(), 55 durationString.equals( duration.toString() ) ); 56 } 57 } 58 } 59 | Popular Tags |