I am currently using JUnit 4.4 and Java 1.6.x. And recently after code fix, in my JUnit tests on this method, we started receiving this AssertionFailed error:
UtilityTest.testParseDate (4t): Monday January 15 09:26: 07 PST 2001 is expected: Monday January 15 09:26:07 PST 2001 "But was:" Mon Jan 15 09:26:07 PST 2001 "
junit.framework. AssertionFailedError: UtilityTest.testParseDate (4t): Mon Jan 15 09:26:07 PST 2001 was expected: But at Utilitest.testSetSetDate (unknown source)
As you can see, expected And w The content looks the same, and after many code inspections, we can not get any clear error in the code. The test run with the actual data has also produced the correct (expected) results.
Have seen this behavior before in the juneet, and if so, did you get reason and / or a fix?
I have seen the same thing in previous versions of Java and JUNIT: always Something like this is random Received when it happens, and usually only "work" was the only piece of code from scratch to retype. Strange, still the only way to remove this error was to try to find some more "concrete" in the behavior of this time.
Thank you,
- Richard
Can post code for Test Person ()?
Are you using the assertEquals () values on the date or are you comparing them in another fashion? If so, can you claim that millisecond's timestamp itself is equal to date?
Comments
Post a Comment