2424
2525import org .junit .jupiter .api .Assertions ;
2626import static org .junit .jupiter .api .Assertions .assertEquals ;
27+ import org .junit .jupiter .api .BeforeAll ;
2728import org .junit .jupiter .api .Test ;
2829
2930/**
3233 */
3334class 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