@@ -97,9 +97,10 @@ public void testToBlob_stringsAndTarArchiveEntriesWithCompression() throws IOExc
97
97
98
98
@ Test
99
99
public void testToBlob_multiByte () throws IOException {
100
- testTarStreamBuilder .addByteEntry ("日本語" .getBytes (StandardCharsets .UTF_8 ), "test" , creationTime );
101
100
testTarStreamBuilder .addByteEntry (
102
- "asdf" .getBytes (StandardCharsets .UTF_8 ), "crepecake" , creationTime );
101
+ "日本語" .getBytes (StandardCharsets .UTF_8 ), "test" , Instant .EPOCH );
102
+ testTarStreamBuilder .addByteEntry (
103
+ "asdf" .getBytes (StandardCharsets .UTF_8 ), "crepecake" , Instant .EPOCH );
103
104
testTarStreamBuilder .addBlobEntry (
104
105
Blobs .from ("jib" ), "jib" .getBytes (StandardCharsets .UTF_8 ).length , "jib" , Instant .EPOCH );
105
106
@@ -124,11 +125,13 @@ public void testToBlob_multiByte() throws IOException {
124
125
Assert .assertEquals ("crepecake" , headerFile .getName ());
125
126
Assert .assertEquals (
126
127
"asdf" , new String (ByteStreams .toByteArray (tarArchiveInputStream ), StandardCharsets .UTF_8 ));
128
+ Assert .assertEquals (Instant .EPOCH , headerFile .getModTime ().toInstant ());
127
129
128
130
headerFile = tarArchiveInputStream .getNextTarEntry ();
129
131
Assert .assertEquals ("jib" , headerFile .getName ());
130
132
Assert .assertEquals (
131
133
"jib" , new String (ByteStreams .toByteArray (tarArchiveInputStream ), StandardCharsets .UTF_8 ));
134
+ Assert .assertEquals (Instant .EPOCH , headerFile .getModTime ().toInstant ());
132
135
133
136
Assert .assertNull (tarArchiveInputStream .getNextTarEntry ());
134
137
}
@@ -150,27 +153,27 @@ private void setUpWithTarEntries() {
150
153
/** Creates a TarStreamBuilder using Strings. */
151
154
private void setUpWithStrings () {
152
155
// Prepares a test TarStreamBuilder.
153
- testTarStreamBuilder .addByteEntry (fileAContents , "some/path/to/resourceFileA" , creationTime );
154
- testTarStreamBuilder .addByteEntry (fileBContents , "crepecake" , creationTime );
156
+ testTarStreamBuilder .addByteEntry (fileAContents , "some/path/to/resourceFileA" , Instant . EPOCH );
157
+ testTarStreamBuilder .addByteEntry (fileBContents , "crepecake" , Instant . EPOCH );
155
158
testTarStreamBuilder .addTarArchiveEntry (
156
159
new TarArchiveEntry (directoryA .toFile (), "some/path/to" ));
157
160
testTarStreamBuilder .addByteEntry (
158
161
fileAContents ,
159
162
"some/really/long/path/that/exceeds/100/characters/abcdefghijklmnopqrstuvwxyz0123456789012345678901234567890" ,
160
- creationTime );
163
+ Instant . EPOCH );
161
164
}
162
165
163
166
/** Creates a TarStreamBuilder using Strings and TarArchiveEntries. */
164
167
private void setUpWithStringsAndTarEntries () {
165
168
// Prepares a test TarStreamBuilder.
166
- testTarStreamBuilder .addByteEntry (fileAContents , "some/path/to/resourceFileA" , creationTime );
169
+ testTarStreamBuilder .addByteEntry (fileAContents , "some/path/to/resourceFileA" , Instant . EPOCH );
167
170
testTarStreamBuilder .addTarArchiveEntry (new TarArchiveEntry (fileB .toFile (), "crepecake" ));
168
171
testTarStreamBuilder .addTarArchiveEntry (
169
172
new TarArchiveEntry (directoryA .toFile (), "some/path/to" ));
170
173
testTarStreamBuilder .addByteEntry (
171
174
fileAContents ,
172
175
"some/really/long/path/that/exceeds/100/characters/abcdefghijklmnopqrstuvwxyz0123456789012345678901234567890" ,
173
- creationTime );
176
+ Instant . EPOCH );
174
177
}
175
178
176
179
/** Creates a compressed blob from the TarStreamBuilder and verifies it. */
@@ -215,18 +218,21 @@ private void verifyTarArchive(TarArchiveInputStream tarArchiveInputStream) throw
215
218
// Verifies fileB was archived correctly.
216
219
TarArchiveEntry headerFileB = tarArchiveInputStream .getNextTarEntry ();
217
220
Assert .assertEquals ("crepecake" , headerFileB .getName ());
221
+ Assert .assertEquals (Instant .EPOCH , headerFileB .getModTime ().toInstant ());
218
222
byte [] fileBString = ByteStreams .toByteArray (tarArchiveInputStream );
219
223
Assert .assertArrayEquals (fileBContents , fileBString );
220
224
221
225
// Verifies directoryA was archived correctly.
222
226
TarArchiveEntry headerDirectoryA = tarArchiveInputStream .getNextTarEntry ();
223
227
Assert .assertEquals ("some/path/to/" , headerDirectoryA .getName ());
228
+ Assert .assertEquals (Instant .EPOCH , headerDirectoryA .getModTime ().toInstant ());
224
229
225
230
// Verifies the long file was archived correctly.
226
231
TarArchiveEntry headerFileALong = tarArchiveInputStream .getNextTarEntry ();
227
232
Assert .assertEquals (
228
233
"some/really/long/path/that/exceeds/100/characters/abcdefghijklmnopqrstuvwxyz0123456789012345678901234567890" ,
229
234
headerFileALong .getName ());
235
+ Assert .assertEquals (Instant .EPOCH , headerFileALong );
230
236
byte [] fileALongString = ByteStreams .toByteArray (tarArchiveInputStream );
231
237
Assert .assertArrayEquals (fileAContents , fileALongString );
232
238
0 commit comments