Skip to content

Commit f00fbf4

Browse files
committed
fix up test
1 parent f3b77ac commit f00fbf4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

sdk/src/test/java/io/opentdf/platform/sdk/TDFTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import static io.opentdf.platform.sdk.TDF.GLOBAL_KEY_SALT;
3535
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
36+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
3637
import static org.junit.jupiter.api.Assertions.assertThrows;
3738

3839
public class TDFTest {
@@ -507,15 +508,20 @@ public void legacyTDFRoundTrips() throws DecoderException, IOException, Executio
507508
Config.withTargetMode("4.2.1"),
508509
Config.withMimeType(mimeType));
509510

510-
String plainText = "this is extremely sensitive stuff!!!";
511-
InputStream plainTextInputStream = new ByteArrayInputStream(plainText.getBytes());
511+
byte[] data = new byte[129];
512+
new Random().nextBytes(data);
513+
InputStream plainTextInputStream = new ByteArrayInputStream(data);
512514
ByteArrayOutputStream tdfOutputStream = new ByteArrayOutputStream();
513515

514516
TDF tdf = new TDF();
515517
tdf.createTDF(plainTextInputStream, tdfOutputStream, config, kas, null);
516518

519+
var dataOutputStream = new ByteArrayOutputStream();
520+
517521
var reader = tdf.loadTDF(new SeekableInMemoryByteChannel(tdfOutputStream.toByteArray()), kas);
522+
reader.readPayload(dataOutputStream);
518523
assertThat(reader.getManifest().payload.mimeType).isEqualTo(mimeType);
524+
assertArrayEquals(data, dataOutputStream.toByteArray(), "extracted data does not match");
519525
}
520526

521527
@Nonnull

0 commit comments

Comments
 (0)