Author: tilman
Date: Fri Jan 16 12:35:44 2026
New Revision: 1931358
Log:
PDFBOX-5660: refactor
Modified:
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/TestEmbeddedFiles.java
==============================================================================
---
pdfbox/branches/3.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestEmbeddedFiles.java
Fri Jan 16 12:35:39 2026 (r1931357)
+++
pdfbox/branches/3.0/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestEmbeddedFiles.java
Fri Jan 16 12:35:44 2026 (r1931358)
@@ -24,6 +24,7 @@ import java.nio.file.Paths;
import org.junit.jupiter.api.Assertions;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
/**
@@ -32,6 +33,14 @@ import org.junit.jupiter.api.Test;
*/
class TestEmbeddedFiles
{
+ private static final String OUTPUT_DIR = "target/test-output";
+
+ @BeforeAll
+ static void setUp()
+ {
+ new File(OUTPUT_DIR).mkdirs();
+ }
+
/**
* Very basic test of embedding and extracting an attachment.
*
@@ -40,10 +49,9 @@ class TestEmbeddedFiles
@Test
void testEmbeddedFiles() throws IOException
{
- String outputFile = "target/test-output/EmbeddedFile.pdf";
- String embeddedFile = "target/test-output/Test.txt";
+ String outputFile = OUTPUT_DIR + "/EmbeddedFile.pdf";
+ String embeddedFile = OUTPUT_DIR + "/Test.txt";
- new File("target/test-output").mkdirs();
new File(outputFile).delete();
new File(embeddedFile).delete();
String[] args = new String[] { outputFile };
@@ -64,11 +72,9 @@ class TestEmbeddedFiles
@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 collectionFilename = OUTPUT_DIR + "/PortableCollection.pdf";
+ String attachment1Filename = OUTPUT_DIR + "/Test1.txt";
+ String attachment2Filename = OUTPUT_DIR + "/Test2.txt";
String[] args = new String[] { collectionFilename };
CreatePortableCollection.main(args);
ExtractEmbeddedFiles.main(args);