1515import static org .easymock .EasyMock .verify ;
1616import static org .junit .Assert .assertEquals ;
1717
18+ import java .math .BigDecimal ;
19+ import java .time .Instant ;
20+ import java .time .format .DateTimeFormatter ;
1821import java .util .ArrayList ;
1922import java .util .Date ;
23+ import java .util .List ;
2024
2125import org .duracloud .mill .db .repo .JpaSpaceStatsRepo ;
26+ import org .duracloud .reportdata .storage .StoreStatsDTO ;
2227import org .easymock .Capture ;
2328import org .easymock .Mock ;
24- import org .joda .time .format .DateTimeFormat ;
25- import org .joda .time .format .DateTimeFormatter ;
2629import org .junit .Test ;
2730
2831/**
@@ -33,14 +36,14 @@ public class StorageStatsResourceTest {
3336 @ Mock
3437 private JpaSpaceStatsRepo spaceStatsRepo ;
3538
36- @ Test
37- public void testGetStorageStats () throws Exception {
39+ final DateTimeFormatter dateTimeFormatter = DateTimeFormatter .ISO_INSTANT ;
3840
41+ @ Test
42+ public void testGetStorageStats () {
3943 spaceStatsRepo = mock (JpaSpaceStatsRepo .class );
4044 final String accountId = "account-id" ;
4145 final String storeId = "id" ;
42- DateTimeFormatter format = DateTimeFormat .forPattern ("YYYY-MM-dd HH:mm:ss z" ).withZoneUTC ();
43- final Date date = format .parseDateTime ("2019-12-31 12:00:00 UTC" ).toDate ();
46+ final Date date = Date .from (Instant .from (dateTimeFormatter .parse (("2019-12-31T12:00:00Z" ))));
4447
4548 final Capture <Date > captureStart = Capture .newInstance ();
4649 final Capture <Date > captureEnd = Capture .newInstance ();
@@ -57,10 +60,10 @@ public void testGetStorageStats() throws Exception {
5760 final Date end = captureEnd .getValue ();
5861 //assertEquals("Start date should be 00:00:00 GMT of the same day as input date", "2019-12-31 00:00:00 UTC",
5962 // format.print(start.getTime()));
60- assertEquals ("Start date should be 00:00:00 GMT of the next day as input date" , "2019-12-31 00 :00:00 UTC " ,
61- format . print (start .getTime ()));
62- assertEquals ("End date should be 00:00:00 GMT of the next day as input date" , "2020-01-01 00 :00:00 UTC " ,
63- format . print (end .getTime ()));
63+ assertEquals ("Start date should be 00:00:00 GMT of the next day as input date" , "2019-12-31T00 :00:00Z " ,
64+ dateTimeFormatter . format (start .toInstant ()));
65+ assertEquals ("End date should be 00:00:00 GMT of the next day as input date" , "2020-01-01T00 :00:00Z " ,
66+ dateTimeFormatter . format (end .toInstant ()));
6467
6568 }
6669}
0 commit comments