Skip to content

Commit eab2787

Browse files
committed
Switch to java.time
1 parent d3ec23b commit eab2787

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

durastore/src/test/java/org/duracloud/durastore/rest/StorageStatsResourceTest.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@
1515
import static org.easymock.EasyMock.verify;
1616
import static org.junit.Assert.assertEquals;
1717

18+
import java.math.BigDecimal;
19+
import java.time.Instant;
20+
import java.time.format.DateTimeFormatter;
1821
import java.util.ArrayList;
1922
import java.util.Date;
23+
import java.util.List;
2024

2125
import org.duracloud.mill.db.repo.JpaSpaceStatsRepo;
26+
import org.duracloud.reportdata.storage.StoreStatsDTO;
2227
import org.easymock.Capture;
2328
import org.easymock.Mock;
24-
import org.joda.time.format.DateTimeFormat;
25-
import org.joda.time.format.DateTimeFormatter;
2629
import 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

Comments
 (0)