Produced by Araxis Merge on 7/10/2017 1:01:44 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\AraxisMergeCompare\Pri_un\IV-ehmp_cif\ImagingCommon\main\test\java\gov\va\med\imaging | DicomDateFormatTest.java | Thu Jun 29 17:22:56 2017 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\IV-ehmp_cif\ImagingCommon\main\test\java\gov\va\med\imaging | DicomDateFormatTest.java | Thu Jul 6 15:02:39 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 208 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /** | |
| 2 | * | |
| 3 | */ | |
| 4 | package go v.va.med.i maging; | |
| 5 | ||
| 6 | import jav a.text.Dat eFormat; | |
| 7 | import jav a.text.Par seExceptio n; | |
| 8 | import jav a.text.Sim pleDateFor mat; | |
| 9 | import jav a.util.Dat e; | |
| 10 | import jav a.util.Tim eZone; | |
| 11 | ||
| 12 | import jun it.framewo rk.TestCas e; | |
| 13 | ||
| 14 | /** | |
| 15 | * @author
|
|
| 16 | * | |
| 17 | */ | |
| 18 | public cla ss DicomDa teFormatTe st extends TestCase | |
| 19 | { | |
| 20 | pr ivate stat ic final i nt stimulu sDataIndex = 0; | |
| 21 | pr ivate stat ic final i nt results DataIndex = 1; | |
| 22 | pr ivate stat ic final S tring[][] testData = new Strin g[][] | |
| 23 | { | |
| 24 | {"19 000101", " 01-Jan-190 0@00:00:00 .0000 -050 0"}, | |
| 25 | {"20 07", "01-J an-2007@00 :00:00.000 0 -0500"}, | |
| 26 | {"20 0712", "01 -Dec-2007@ 00:00:00.0 000 -0500" }, | |
| 27 | {"20 071230", " 30-Dec-200 7@00:00:00 .0000 -050 0"}, | |
| 28 | {"20 07123012", "30-Dec-2 007@12:00: 00.0000 -0 500"}, | |
| 29 | {"20 0712301234 ", "30-Dec -2007@12:3 4:00.0000 -0500"}, | |
| 30 | {"20 0712301234 56", "30-D ec-2007@12 :34:56.000 0 -0500"}, | |
| 31 | {"20 0712301234 56.9999", "30-Dec-20 07@12:34:5 6.9999 -05 00"}, | |
| 32 | {"20 0712301234 56.999999" , "30-Dec- 2007@12:34 :56.999999 -0500"}, | |
| 33 | {"20 07+0500", "31-Dec-20 06@14:00:0 0.0000 -05 00"}, // 0 1Jan2007 m idnight so mewhere in Asia is 3 1Dec2006 2 PM in EST | |
| 34 | {"20 0712+0500" , "30-Nov- 2007@14:00 :00.0000 - 0500"}, // 0 1Dec2007 m idnight so mewhere in Asia is 3 0Nov2007 2 PM in EST | |
| 35 | {"20 071230+050 0", "29-De c-2007@14: 00:00.0000 -0500"}, // 30Dec2007 midnight somewhere in Asia is 29Dec2007 2PM in ES T | |
| 36 | {"20 07123012+0 500", "30- Dec-2007@0 2:00:00.00 00 -0500"} , // 30Dec2007 noon some where in A sia is 30D ec2007 2AM in EST | |
| 37 | {"20 0712301234 +0500", "3 0-Dec-2007 @02:34:00. 0000 -0500 "}, // 30Dec2007 12:34 som ewhere in Asia is 30 Dec2007 2: 34AM in ES T | |
| 38 | {"20 0712301234 56+0500", "30-Dec-20 07@02:34:5 6.0000 -05 00"} // 30Dec2007 12:34:56 somewhere in Asia is 30Dec2007 2:34:56AM in EST | |
| 39 | ||
| 40 | }; | |
| 41 | ||
| 42 | pr ivate Dico mDateForma t dicomDf = new Dico mDateForma t(); | |
| 43 | pr ivate Date Format res ultDf = ne w SimpleDa teFormat(" dd-MMM-yyy y@HH:mm:ss .S ZZZZZ") ; | |
| 44 | ||
| 45 | /* * | |
| 46 | * Test meth od for {@l ink gov.va .med.imagi ng.DicomDa teFormat#p arse(java. lang.Strin g)}. | |
| 47 | * / | |
| 48 | pu blic void testParseS tring() | |
| 49 | { | |
| 50 | // I f the VM h as a defau lt other t han GMT-5 (i.e. EST) we need t o switch t o GMT-5 fo r the test s to work | |
| 51 | Time Zone.setDe fault(Time Zone.getTi meZone("GM T-5")); | |
| 52 | ||
| 53 | for( String[] t estSample : testData ) | |
| 54 | { | |
| 55 | String stimulus = testSamp le[stimulu sDataIndex ]; | |
| 56 | String desiredRe sult = tes tSample[re sultsDataI ndex]; | |
| 57 | ||
| 58 | try | |
| 59 | { | |
| 60 | Date dic omDate = d icomDf.par se(stimulu s); | |
| 61 | Date res ultsDate = resultDf. parse(desi redResult) ; | |
| 62 | ||
| 63 | assertEq uals("Fail ure transl ating '" + dicomDate + "'", di comDate, r esultsDate ); | |
| 64 | } | |
| 65 | catch (ParseExce ption x) | |
| 66 | { | |
| 67 | fail(x.g etMessage( )); | |
| 68 | } | |
| 69 | ||
| 70 | } | |
| 71 | } | |
| 72 | ||
| 73 | // pr ivate void sumpin() | |
| 74 | // { | |
| 75 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 007")) ); // year | |
| 76 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 00712")) ) ; // year, month | |
| 77 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230")) ); // yea r, month, day | |
| 78 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 007123012" )) ); // y ear, month , day, hou r | |
| 79 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230123 4")) ); // year, mon th, day, h our, minut e | |
| 80 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230123 456")) ); // year, m onth, day, hour, min ute, secon d | |
| 81 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230123 456.9999") ) ); // ye ar, month, day, hour , minute, second, mi llisecond | |
| 82 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230123 456.999999 ")) ); // year, mont h, day, ho ur, minute , second, millisecon d | |
| 83 | // | |
| 84 | // // r epeat all of the abo ve with po sitive tim ezone | |
| 85 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 007+0500") ) ); // ye ar | |
| 86 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 00712+0500 ")) ); // year, mont h | |
| 87 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230+05 00")) ); / / year, mo nth, day | |
| 88 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 007123012+ 0500")) ); // year, month, day , hour | |
| 89 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230123 4+0500")) ); // year , month, d ay, hour, minute | |
| 90 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230123 456+0500") ) ); // ye ar, month, day, hour , minute, second | |
| 91 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230123 456.9999+0 500")) ); // year, m onth, day, hour, min ute, secon d, millise cond | |
| 92 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230123 456.999999 +0500")) ) ; // year, month, da y, hour, m inute, sec ond, milli second | |
| 93 | // | |
| 94 | // // r epeat all of the abo ve with ne gative tim ezone | |
| 95 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 007-0500") ) ); // ye ar | |
| 96 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 00712-0500 ")) ); // year, mont h | |
| 97 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230-05 00")) ); / / year, mo nth, day | |
| 98 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 007123012- 0500")) ); // year, month, day , hour | |
| 99 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230123 4-0500")) ); // year , month, d ay, hour, minute | |
| 100 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230123 456-0500") ) ); // ye ar, month, day, hour , minute, second | |
| 101 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230123 456.9999-0 500")) ); // year, m onth, day, hour, min ute, secon d, millise cond | |
| 102 | // Syst em.out.pri ntln( "Res ult is '" + outputDf .format(pa rseDate("2 0071230123 456.999999 -0500")) ) ; // year, month, da y, hour, m inute, sec ond, milli second | |
| 103 | // | |
| 104 | // } | |
| 105 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.