@@ -47,8 +47,7 @@ void saveGossipMessageDecodingError_shouldSaveToFile(@TempDir Path tempDir) {
47
47
final String topic = "test_topic" ;
48
48
manager .saveGossipMessageDecodingError ("test_topic" , arrivalTimestamp , messageBytes );
49
49
50
- final String fileName =
51
- String .format ("%s.ssz" , DebugDataDumper .formatTimestamp (arrivalTimestamp ));
50
+ final String fileName = String .format ("%s.ssz" , manager .formatTimestamp (arrivalTimestamp ));
52
51
final Path expectedFile =
53
52
tempDir
54
53
.resolve ("gossip_messages" )
@@ -66,8 +65,7 @@ void saveGossipMessageDecodingError_shouldNotSaveToFileWhenDisabled(@TempDir Pat
66
65
manager .saveGossipMessageDecodingError ("test_topic" , arrivalTimestamp , messageBytes );
67
66
assertThat (manager .isEnabled ()).isFalse ();
68
67
69
- final String fileName =
70
- String .format ("%s.ssz" , DebugDataDumper .formatTimestamp (arrivalTimestamp ));
68
+ final String fileName = String .format ("%s.ssz" , manager .formatTimestamp (arrivalTimestamp ));
71
69
final Path expectedFile =
72
70
tempDir .resolve ("gossip_messages" ).resolve ("decoding_error" ).resolve (fileName );
73
71
checkFileNotExist (expectedFile );
@@ -81,8 +79,7 @@ void saveGossipRejectedMessageToFile_shouldSaveToFile(@TempDir Path tempDir) {
81
79
final String topic = "test_topic" ;
82
80
manager .saveGossipRejectedMessageToFile ("test_topic" , arrivalTimestamp , messageBytes );
83
81
84
- final String fileName =
85
- String .format ("%s.ssz" , DebugDataDumper .formatTimestamp (arrivalTimestamp ));
82
+ final String fileName = String .format ("%s.ssz" , manager .formatTimestamp (arrivalTimestamp ));
86
83
final Path expectedFile =
87
84
tempDir .resolve ("gossip_messages" ).resolve ("rejected" ).resolve (topic ).resolve (fileName );
88
85
checkBytesSavedToFile (expectedFile , messageBytes );
@@ -157,14 +154,16 @@ void constructionOfDirectories_shouldDisableWhenFailedToCreate(@TempDir Path tem
157
154
158
155
@ Test
159
156
void formatTimestamp_shouldFormatDate () {
157
+ final DebugDataDumper manager = new DebugDataDumper (Path .of ("." ), true );
160
158
final String formattedTimestamp =
161
- DebugDataDumper .formatTimestamp (Optional .of (timeProvider .getTimeInMillis ()));
159
+ manager .formatTimestamp (Optional .of (timeProvider .getTimeInMillis ()));
162
160
assertThat (formattedTimestamp ).isEqualTo ("1970-01-01T12:46:40.00" );
163
161
}
164
162
165
163
@ Test
166
164
void formatTimestamp_shouldReturnConsistentUnknown () {
167
- final String formattedTimestamp = DebugDataDumper .formatTimestamp (Optional .empty ());
165
+ final DebugDataDumper manager = new DebugDataDumper (Path .of ("." ), true );
166
+ final String formattedTimestamp = manager .formatTimestamp (Optional .empty ());
168
167
assertThat (formattedTimestamp ).isEqualTo ("unknown" );
169
168
}
170
169
0 commit comments