|
22 | 22 | import java.nio.file.Files;
|
23 | 23 | import java.nio.file.NoSuchFileException;
|
24 | 24 | import java.nio.file.Path;
|
| 25 | +import java.sql.Date; |
| 26 | +import java.text.DateFormat; |
| 27 | +import java.text.SimpleDateFormat; |
25 | 28 | import java.util.Optional;
|
26 | 29 | import org.apache.tuweni.bytes.Bytes;
|
27 | 30 | import org.junit.jupiter.api.Test;
|
@@ -162,14 +165,20 @@ void formatTimestamp_shouldFormatDate() {
|
162 | 165 | final DebugDataDumper manager = new DebugDataDumper(Path.of("."), true);
|
163 | 166 | final String formattedTimestamp =
|
164 | 167 | 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)); |
166 | 172 | }
|
167 | 173 |
|
168 | 174 | @Test
|
169 | 175 | void generateTimestamp_shouldGenerateTimestamp() {
|
170 | 176 | final DebugDataDumper manager = new DebugDataDumper(Path.of("."), true);
|
171 | 177 | 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)); |
173 | 182 | }
|
174 | 183 |
|
175 | 184 | private void checkBytesSavedToFile(final Path path, final Bytes expectedBytes) {
|
|
0 commit comments