Skip to content

Commit

Permalink
Update JSON test to disregard fractional seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
rorbech committed Aug 8, 2023
1 parent 1404d54 commit bee43e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
Expand Down Expand Up @@ -1939,7 +1940,7 @@ public void setValue_specificType_internalNameOnDynamicRealms() {

@Test
public void asJSON() throws JSONException {
Date date = Calendar.getInstance().getTime();
Date date = Date.from(Calendar.getInstance().getTime().toInstant().truncatedTo(ChronoUnit.SECONDS));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("GMT")); // Core return dates in UTC time
String now = sdf.format(date);
Expand Down Expand Up @@ -2144,7 +2145,7 @@ public void asJSON_withEscaping() throws JSONException {

@Test
public void asJSON_cycles() throws JSONException {
Date date = Calendar.getInstance().getTime();
Date date = Date.from(Calendar.getInstance().getTime().toInstant().truncatedTo(ChronoUnit.SECONDS));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("GMT")); // Core return dates in UTC time
String now = sdf.format(date);
Expand Down

0 comments on commit bee43e8

Please sign in to comment.