Skip to content

Commit

Permalink
fix(tests): format date properly in tests for AbstractExecutionReposi…
Browse files Browse the repository at this point in the history
…toryTest.fetchData
  • Loading branch information
brian-mulier-p committed Nov 28, 2024
1 parent 74b557f commit dd5a313
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;

Expand Down Expand Up @@ -685,14 +687,15 @@ protected void fetchData() throws IOException {
"country", ColumnDescriptor.<Executions.Fields>builder().field(Executions.Fields.LABELS).labelKey("country").build(),
"date", ColumnDescriptor.<Executions.Fields>builder().field(Executions.Fields.START_DATE).build()
)).build(),
ZonedDateTime.now().minus(1, ChronoUnit.DAYS),
ZonedDateTime.now().minus(1, ChronoUnit.HOURS),
ZonedDateTime.now()
);

assertThat(data.size(), is(1));
assertThat(data.get(0).get("count"), is(1L));
assertThat(data.get(0).get("country"), is("FR"));
assertThat(data.get(0).get("date"), is(execution.getState().getStartDate()));
Instant startDate = execution.getState().getStartDate();
assertThat(data.get(0).get("date"), is(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").format(ZonedDateTime.ofInstant(startDate, ZoneId.systemDefault()).withSecond(0).withNano(0))));
}

private static Execution buildWithCreatedDate(Instant instant) {
Expand Down

0 comments on commit dd5a313

Please sign in to comment.