1616package org .labkey .test .tests .external .labModules ;
1717
1818import org .apache .commons .lang3 .StringUtils ;
19+ import org .apache .commons .lang3 .time .DateFormatUtils ;
20+ import org .apache .commons .lang3 .time .DateUtils ;
1921import org .apache .commons .lang3 .tuple .Pair ;
2022import org .apache .poi .ss .usermodel .Sheet ;
2123import org .apache .poi .ss .usermodel .Workbook ;
2224import org .junit .Assert ;
2325import org .junit .Test ;
2426import org .junit .experimental .categories .Category ;
27+ import org .labkey .api .util .DateUtil ;
2528import org .labkey .remoteapi .CommandException ;
2629import org .labkey .remoteapi .Connection ;
2730import org .labkey .remoteapi .collections .CaseInsensitiveHashMap ;
@@ -1415,6 +1418,7 @@ private void samplesTableTest() throws Exception
14151418 columnLabels .add (getColumnLabel (srr , name ));
14161419 }
14171420
1421+ SimpleDateFormat dateFormat = new SimpleDateFormat ("yyyy-MM-dd" );
14181422 List <List <String >> rows = new ArrayList <>();
14191423 for (Map <String , Object > row : srr .getRows ())
14201424 {
@@ -1425,7 +1429,7 @@ private void samplesTableTest() throws Exception
14251429 String val = row .get (name ) == null ? "" : String .valueOf (row .get (name ));
14261430 if (name .toLowerCase ().contains ("date" ))
14271431 {
1428- val = StringUtils .isEmpty (val ) ? "" : ExcelHelper . getDateTimeFormat (). format (new Date (val ));
1432+ val = StringUtils .isEmpty (val ) ? "" : dateFormat . format (Date . parse (val ));
14291433 }
14301434
14311435 target .add (val );
@@ -1440,10 +1444,10 @@ private void samplesTableTest() throws Exception
14401444 List <List <String >> lines = ExcelHelper .getFirstNRows (sheet , 5 );
14411445
14421446 Assert .assertEquals (columnLabels , lines .get (0 ));
1443- Assert .assertEquals (rows .get (0 ), lines .get (1 ));
1444- Assert .assertEquals (rows .get (0 ), lines .get (2 ));
1445- Assert .assertEquals (rows .get (1 ), lines .get (3 ));
1446- Assert .assertEquals (rows .get (1 ), lines .get (4 ));
1447+ Assert .assertEquals ("Row did not match. ExcelHelper pattern: " + ExcelHelper . getDateTimeFormat (). toPattern (), rows .get (0 ), lines .get (1 ));
1448+ Assert .assertEquals ("Row did not match. ExcelHelper pattern: " + ExcelHelper . getDateTimeFormat (). toPattern (), rows .get (0 ), lines .get (2 ));
1449+ Assert .assertEquals ("Row did not match. ExcelHelper pattern: " + ExcelHelper . getDateTimeFormat (). toPattern (), rows .get (1 ), lines .get (3 ));
1450+ Assert .assertEquals ("Row did not match. ExcelHelper pattern: " + ExcelHelper . getDateTimeFormat (). toPattern (), rows .get (1 ), lines .get (4 ));
14471451 }
14481452
14491453 refresh ();
0 commit comments