Author: tilman
Date: Fri Jan 16 11:46:17 2026
New Revision: 1931343
Log:
PDFBOX-5660: move test to existing class
Modified:
pdfbox/branches/3.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFilesTest.java
pdfbox/branches/3.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestEmbeddedFiles.java
Modified:
pdfbox/branches/3.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFilesTest.java
==============================================================================
---
pdfbox/branches/3.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFilesTest.java
Fri Jan 16 11:46:12 2026 (r1931342)
+++
pdfbox/branches/3.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFilesTest.java
Fri Jan 16 11:46:17 2026 (r1931343)
@@ -15,44 +15,10 @@
*/
package org.apache.pdfbox.examples.pdmodel;
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.jupiter.api.Test;
-
/**
*
* @author Tilman Hausherr
*/
class ExtractEmbeddedFilesTest
{
- /**
- * Test that the correct attachments are extracted from a portable
collection.
- *
- * @throws IOException
- */
- @Test
- void testExtractEmbeddedFiles() throws IOException
- {
- String dir = "target/test-output";
- new File(dir).mkdirs();
- String collectionFilename = dir + "/PortableCollection.pdf";
- String attachment1Filename = dir + "/Test1.txt";
- String attachment2Filename = dir + "/Test2.txt";
- String[] args = new String[] { collectionFilename };
- CreatePortableCollection.main(args);
- ExtractEmbeddedFiles.main(args);
- byte[] ba1 = Files.readAllBytes(new
File(attachment1Filename).toPath());
- byte[] ba2 = Files.readAllBytes(new
File(attachment2Filename).toPath());
- String s1 = new String(ba1, StandardCharsets.US_ASCII);
- String s2 = new String(ba2, StandardCharsets.US_ASCII);
- assertEquals("This is the contents of the first embedded file", s1);
- assertEquals("This is the contents of the second embedded file", s2);
- Files.delete(Paths.get(collectionFilename));
- Files.delete(Paths.get(attachment1Filename));
- Files.delete(Paths.get(attachment2Filename));
- }
}
Modified:
pdfbox/branches/3.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestEmbeddedFiles.java
==============================================================================
---
pdfbox/branches/3.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestEmbeddedFiles.java
Fri Jan 16 11:46:12 2026 (r1931342)
+++
pdfbox/branches/3.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestEmbeddedFiles.java
Fri Jan 16 11:46:17 2026 (r1931343)
@@ -23,6 +23,7 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import org.junit.jupiter.api.Assertions;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
/**
@@ -54,4 +55,31 @@ class TestEmbeddedFiles
new File(embeddedFile).delete();
new File(outputFile).delete();
}
+
+ /**
+ * Test that the correct attachments are extracted from a portable
collection.
+ *
+ * @throws IOException
+ */
+ @Test
+ void testExtractEmbeddedFiles() throws IOException
+ {
+ String dir = "target/test-output";
+ new File(dir).mkdirs();
+ String collectionFilename = dir + "/PortableCollection.pdf";
+ String attachment1Filename = dir + "/Test1.txt";
+ String attachment2Filename = dir + "/Test2.txt";
+ String[] args = new String[] { collectionFilename };
+ CreatePortableCollection.main(args);
+ ExtractEmbeddedFiles.main(args);
+ byte[] ba1 = Files.readAllBytes(new
File(attachment1Filename).toPath());
+ byte[] ba2 = Files.readAllBytes(new
File(attachment2Filename).toPath());
+ String s1 = new String(ba1, StandardCharsets.US_ASCII);
+ String s2 = new String(ba2, StandardCharsets.US_ASCII);
+ assertEquals("This is the contents of the first embedded file", s1);
+ assertEquals("This is the contents of the second embedded file", s2);
+ Files.delete(Paths.get(collectionFilename));
+ Files.delete(Paths.get(attachment1Filename));
+ Files.delete(Paths.get(attachment2Filename));
+ }
}
\ No newline at end of file