99import org .collage .template .TemplateSource ;
1010import org .jooq .lambda .Sneaky ;
1111import org .junit .jupiter .api .Test ;
12- import org .xcommand .core .DynaBeanProvider ;
1312import org .xcommand .core .ICommand ;
14- import org .xcommand .core .IDynaBeanProvider ;
1513import org .xcommand .core .TCP ;
1614
1715class Javassist2Test {
18- IDynaBeanProvider dbp = DynaBeanProvider .newThreadClassMethodInstance ();
1916
2017 void initializeContext () {
2118 TCP .pushContext (new HashMap <>());
@@ -27,23 +24,23 @@ void tearDownContext() {
2724 }
2825
2926 @ Test
30- void verify_that_recursive_template_resolving_works () throws Exception {
27+ void verify_that_recursive_template_resolving_works () {
3128 TCP .start (Sneaky .runnable (() -> {
3229 initializeContext ();
33- var s =
34- """
35- Header
36-
37- <?java for (int i = 0; i< 3; i++) {?>
38- hallo ${name}.
39- Wie gehts?
40- <?java }?>
41- Footer
42- """ ;
4330
4431 // First replace '${name}' with '${firstname} ${lastname}':
4532 TCP .pushContext (new HashMap <>());
4633 TCP .getContext ().put ("name" , "${firstname} ${lastname}" );
34+ var s =
35+ """
36+ Header
37+
38+ <?java for (int i = 0; i< 3; i++) {?>
39+ hallo ${name}.
40+ Wie gehts?
41+ <?java }?>
42+ Footer
43+ """ ;
4744 ICommand cmd = TemplateFactory .newRecursiveTemplateInstance (new TemplateSource (s ));
4845 TCP .popContext ();
4946
@@ -74,22 +71,22 @@ void verify_that_recursive_template_resolving_works() throws Exception {
7471 }
7572
7673 @ Test
77- void verify_that_recursive_template_resolving_works_with_3_levels_of_nesting () throws Exception {
74+ void verify_that_recursive_template_resolving_works_with_3_levels_of_nesting () {
7875 TCP .start (Sneaky .runnable (() -> {
7976 initializeContext ();
80- // person -> nameAndAddress -> address:
81- String person = "${person}" ;
82- String nameAndAddress = "${firstname} ${lastname} ${address}" ;
83- String address = """
84-
85- Sohlweg 13
86- D-79589 Binzen
87- """ ;
8877
8978 // Use new context for template command creation:
90- TCP .pushContext (new HashMap ());
79+ TCP .pushContext (new HashMap <>());
80+ // person -> nameAndAddress -> address:
81+ String nameAndAddress = "${firstname} ${lastname} ${address}" ;
9182 TCP .getContext ().put ("person" , nameAndAddress );
83+ String address = """
84+
85+ Sohlweg 13
86+ D-79589 Binzen
87+ """ ;
9288 TCP .getContext ().put ("address" , address );
89+ String person = "${person}" ;
9390 ICommand cmd = TemplateFactory .newRecursiveTemplateInstance (new TemplateSource (person ));
9491 TCP .popContext ();
9592
0 commit comments