Skip to content

Commit ae09a43

Browse files
committed
Fix unit test
1 parent e82a751 commit ae09a43

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Diff for: ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/DebugDataDumperTest.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
import java.nio.file.Files;
2323
import java.nio.file.NoSuchFileException;
2424
import java.nio.file.Path;
25+
import java.sql.Date;
26+
import java.text.DateFormat;
27+
import java.text.SimpleDateFormat;
2528
import java.util.Optional;
2629
import org.apache.tuweni.bytes.Bytes;
2730
import org.junit.jupiter.api.Test;
@@ -162,14 +165,20 @@ void formatTimestamp_shouldFormatDate() {
162165
final DebugDataDumper manager = new DebugDataDumper(Path.of("."), true);
163166
final String formattedTimestamp =
164167
manager.formatOptionalTimestamp(Optional.of(timeProvider.getTimeInMillis()));
165-
assertThat(formattedTimestamp).isEqualTo("1970-01-01T12_46_40.00");
168+
169+
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss.SS");
170+
final Date date = new Date(timeProvider.getTimeInMillis().longValue());
171+
assertThat(formattedTimestamp).isEqualTo(df.format(date));
166172
}
167173

168174
@Test
169175
void generateTimestamp_shouldGenerateTimestamp() {
170176
final DebugDataDumper manager = new DebugDataDumper(Path.of("."), true);
171177
final String formattedTimestamp = manager.generateTimestamp(timeProvider);
172-
assertThat(formattedTimestamp).isEqualTo("1970-01-01T12_46_40.00");
178+
179+
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss.SS");
180+
final Date date = new Date(timeProvider.getTimeInMillis().longValue());
181+
assertThat(formattedTimestamp).isEqualTo(df.format(date));
173182
}
174183

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

0 commit comments

Comments
 (0)