11package org .quickfixj .codegenerator ;
22
3- import static org .junit .Assert .*;
3+ import static org .junit .jupiter . api . Assertions .*;
44
55import java .io .File ;
66import java .io .FileNotFoundException ;
77import java .io .IOException ;
88import java .util .Scanner ;
99
10- import org .junit .Before ;
11- import org .junit .Rule ;
12- import org .junit .Test ;
13- import org .junit .rules .TemporaryFolder ;
10+ import org .junit .jupiter .api .BeforeEach ;
11+ import org .junit .jupiter .api .Test ;
12+ import org .junit .jupiter .api .io .TempDir ;
1413
1514/**
1615 * Test for issue #1084: Verify that MessageCodeGenerator correctly sets the
1918 */
2019public class NestedComponentDelimiterTest {
2120
22- @ Rule
23- public TemporaryFolder tempFolder = new TemporaryFolder () ;
21+ @ TempDir
22+ File tempFolder ;
2423
2524 private File dictFile = new File ("./src/test/resources/org/quickfixj/codegenerator/NestedComponentsTest.xml" );
2625 private File schemaDirectory = new File ("./src/main/resources/org/quickfixj/codegenerator" );
2726 private String fieldPackage = "quickfix.field" ;
2827 private String messagePackage = "quickfix.test" ;
2928 private MessageCodeGenerator generator ;
3029
31- @ Before
30+ @ BeforeEach
3231 public void setup () throws IOException {
3332 generator = new MessageCodeGenerator ();
3433 }
@@ -41,7 +40,7 @@ public void testNestedComponentGroupDelimiter() throws Exception {
4140 task .setSpecification (dictFile );
4241 task .setTransformDirectory (schemaDirectory );
4342 task .setMessagePackage (messagePackage );
44- task .setOutputBaseDirectory (tempFolder . getRoot () );
43+ task .setOutputBaseDirectory (tempFolder );
4544 task .setFieldPackage (fieldPackage );
4645 task .setOverwrite (true );
4746 task .setOrderedFields (true );
@@ -50,29 +49,29 @@ public void testNestedComponentGroupDelimiter() throws Exception {
5049 generator .generate (task );
5150
5251 // Verify that the NestedTwice component was generated
53- String componentPath = tempFolder .getRoot (). getAbsolutePath () + "/quickfix/test/component/NestedTwice.java" ;
52+ String componentPath = tempFolder .getAbsolutePath () + "/quickfix/test/component/NestedTwice.java" ;
5453 File componentFile = new File (componentPath );
55- assertTrue ("NestedTwice component file should exist" , componentFile . exists () );
54+ assertTrue (componentFile . exists (), "NestedTwice component file should exist" );
5655
5756 // Read the generated file and check for the correct constructor
5857 String fileContent = readFileContent (componentFile );
5958
6059 // Verify the NoEntries group class is present
61- assertTrue ("NoEntries group class should be present" ,
62- fileContent . contains ( "public static class NoEntries extends Group" ) );
60+ assertTrue (fileContent . contains ( "public static class NoEntries extends Group" ),
61+ "NoEntries group class should be present" );
6362
6463 // Verify the ORDER array is present
65- assertTrue ("ORDER array should be present" ,
66- fileContent . contains ( "private static final int[] ORDER =" ) );
64+ assertTrue (fileContent . contains ( "private static final int[] ORDER =" ),
65+ "ORDER array should be present" );
6766
6867 // Verify the constructor has the correct delimiter (58 is the field number for Text)
6968 // The constructor should be: super(20001, 58, ORDER);
70- assertTrue ("Constructor should contain correct delimiter" ,
71- fileContent . contains ( "super(20001, 58, ORDER);" ) );
69+ assertTrue (fileContent . contains ( "super(20001, 58, ORDER);" ),
70+ "Constructor should contain correct delimiter" );
7271
7372 // Also verify it doesn't have an empty delimiter (the bug case)
74- assertFalse ("Constructor should not have empty delimiter" ,
75- fileContent . contains ( "super(20001, , ORDER);" ) );
73+ assertFalse (fileContent . contains ( "super(20001, , ORDER);" ),
74+ "Constructor should not have empty delimiter" );
7675 }
7776
7877 private String readFileContent (File file ) throws FileNotFoundException {
0 commit comments