Skip to content

Commit 7e73934

Browse files
committed
PDFBOX-5660: refactor
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1931357 13f79535-47bb-0310-9956-ffa450edef68
1 parent cc25a52 commit 7e73934

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestEmbeddedFiles.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import org.junit.jupiter.api.Assertions;
2626
import static org.junit.jupiter.api.Assertions.assertEquals;
27+
import org.junit.jupiter.api.BeforeAll;
2728
import org.junit.jupiter.api.Test;
2829

2930
/**
@@ -32,6 +33,14 @@
3233
*/
3334
class TestEmbeddedFiles
3435
{
36+
private static final String OUTPUT_DIR = "target/test-output";
37+
38+
@BeforeAll
39+
static void setUp()
40+
{
41+
new File(OUTPUT_DIR).mkdirs();
42+
}
43+
3544
/**
3645
* Very basic test of embedding and extracting an attachment.
3746
*
@@ -40,10 +49,9 @@ class TestEmbeddedFiles
4049
@Test
4150
void testEmbeddedFiles() throws IOException
4251
{
43-
String outputFile = "target/test-output/EmbeddedFile.pdf";
44-
String embeddedFile = "target/test-output/Test.txt";
52+
String outputFile = OUTPUT_DIR + "/EmbeddedFile.pdf";
53+
String embeddedFile = OUTPUT_DIR + "/Test.txt";
4554

46-
new File("target/test-output").mkdirs();
4755
new File(outputFile).delete();
4856
new File(embeddedFile).delete();
4957
String[] args = { outputFile };
@@ -64,11 +72,9 @@ void testEmbeddedFiles() throws IOException
6472
@Test
6573
void testExtractEmbeddedFiles() throws IOException
6674
{
67-
String dir = "target/test-output";
68-
new File(dir).mkdirs();
69-
String collectionFilename = dir + "/PortableCollection.pdf";
70-
String attachment1Filename = dir + "/Test1.txt";
71-
String attachment2Filename = dir + "/Test2.txt";
75+
String collectionFilename = OUTPUT_DIR + "/PortableCollection.pdf";
76+
String attachment1Filename = OUTPUT_DIR + "/Test1.txt";
77+
String attachment2Filename = OUTPUT_DIR + "/Test2.txt";
7278
String[] args = new String[] { collectionFilename };
7379
CreatePortableCollection.main(args);
7480
ExtractEmbeddedFiles.main(args);

0 commit comments

Comments
 (0)