Skip to content

Commit

Permalink
Fix windows build can't use : in filename
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyeh committed Apr 12, 2024
1 parent 9945286 commit 69c7488
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ String formatOptionalTimestamp(final Optional<UInt64> maybeTimestamp) {

@VisibleForTesting
String formatTimestamp(final UInt64 arrivalTimestamp) {
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS");
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss.SS");
final Date date = new Date(arrivalTimestamp.longValue());
return df.format(date);
}

@VisibleForTesting
String generateTimestamp(final TimeProvider timeProvider) {
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS");
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss.SS");
final Date date = new Date(timeProvider.getTimeInMillis().longValue());
return df.format(date);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,14 @@ void formatTimestamp_shouldFormatDate() {
final DebugDataDumper manager = new DebugDataDumper(Path.of("."), true);
final String formattedTimestamp =
manager.formatOptionalTimestamp(Optional.of(timeProvider.getTimeInMillis()));

final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS");
final Date expectedDate = new Date(timeProvider.getTimeInMillis().longValue());
assertThat(formattedTimestamp).isEqualTo(df.format(expectedDate));
assertThat(formattedTimestamp).isEqualTo("1970-01-01T12_46_40.00");
}

@Test
void generateTimestamp_shouldGenerateTimestamp() {
final DebugDataDumper manager = new DebugDataDumper(Path.of("."), true);
final String formattedTimestamp = manager.generateTimestamp(timeProvider);

final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS");
final Date expectedDate = new Date(timeProvider.getTimeInMillis().longValue());
assertThat(formattedTimestamp).isEqualTo(df.format(expectedDate));
assertThat(formattedTimestamp).isEqualTo("1970-01-01T12_46_40.00");
}

private void checkBytesSavedToFile(final Path path, final Bytes expectedBytes) {
Expand Down

0 comments on commit 69c7488

Please sign in to comment.