Ok, thanks for the hint.
I see that those timezones look strange. But since I am using the same
zones and the same DateTimeFormat for serialization and deserialization,
I expected to receive the same result.

How should the test case be changed to work properly? What am I doing
wrong here?


Regards,

Johannes

Brian S O'Neill wrote:
> Here's a hint: notice the seconds field in the expected and actual time 
> zone.
> 
> Johannes Schneider wrote:
>> Hi,
>>
>> I have a problem with serialization/deserialization. I am sure I am
>> doing something wrong - just can't find out what it is.
>>
>> First I serialize a new DateTime( 1, 1, 1, 1, 1, 1, 1, zone )
>> with  ISODateTimeFormat.basicDateTime()
>>
>> Then deserialize it again and compare the two values --> this is the result:
>>
>>
>> Expected :0001-01-01T01:01:01.001-04:56:02
>> Actual   :0001-01-01T01:00:59.001-04:56:02
>>
>>
>>
>> Any hints?
>>
>>
>> Thanks,
>>
>> Johannes
>>
>>
>>
>> Complete Test (TestNG based, but should run with JUnit, too)
>>
>>
>>
>>  @Test
>>   public void testLoosingTwoSecondsTest() {
>>     DateTimeZone oldDefault = DateTimeZone.getDefault();
>>     try {
>>       DateTimeZone zone = DateTimeZone.forID( "America/New_York" );
>>       DateTimeZone.setDefault( zone );
>>       DateTime dateTime = new DateTime( 1, 1, 1, 1, 1, 1, 1, zone );
>>
>>       DateTimeFormatter format = ISODateTimeFormat.basicDateTime();
>>
>>       //Compare string pbased
>>       assertEquals( format.print( dateTime ), "00010101T010101.001-0456" );
>>
>>       //Round
>>       assertEquals( format.parseDateTime( format.print( dateTime ) ),
>> dateTime );
>>     } finally {
>>       DateTimeZone.setDefault( oldDefault );
>>     }
>>   }
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Joda-interest mailing list
>> Joda-interest@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/joda-interest
>>
>>   
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Joda-interest mailing list
> Joda-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joda-interest

------------------------------------------------------------------------------
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to