@@ -220,4 +220,45 @@ public void injectSessionState_stateVariableWithInvalidPrefix_returnsPlaceholder
220220
221221 assertThat (result ).isEqualTo (template );
222222 }
223+
224+ @ Test
225+ public void injectSessionState_dollarBracePattern_returnsTemplateAsIs () {
226+ String template = "The formatString supports interpolation via ${expression} syntax." ;
227+
228+ String result = InstructionUtils .injectSessionState (templateContext , template ).blockingGet ();
229+
230+ assertThat (result ).isEqualTo (template );
231+ }
232+
233+ @ Test
234+ public void injectSessionState_dollarBracePatternWithStateVariable_replacesOnlyStateVariable () {
235+ InvocationContext testContext = templateContext .toBuilder ().build ();
236+ testContext .session ().state ().put ("user_name" , "Foo" );
237+ String template = "Hello {user_name}! Interpolation via ${expression} syntax." ;
238+
239+ String result = InstructionUtils .injectSessionState (testContext , template ).blockingGet ();
240+
241+ assertThat (result ).isEqualTo ("Hello Foo! Interpolation via ${expression} syntax." );
242+ }
243+
244+ @ Test
245+ public void injectSessionState_escapedBraces_returnsTemplateAsIs () {
246+ String template = "Literal \\ {expression\\ } syntax." ;
247+
248+ String result = InstructionUtils .injectSessionState (templateContext , template ).blockingGet ();
249+
250+ assertThat (result ).isEqualTo (template );
251+ }
252+
253+ @ Test
254+ public void injectSessionState_dollarDoubleBracePattern_returnsPatternAsIs () {
255+ InvocationContext testContext = templateContext .toBuilder ().build ();
256+ testContext .session ().state ().put ("expression" , "foo" );
257+ testContext .session ().state ().put ("user_name" , "bar" );
258+ String template = "Workflow syntax: ${{expression}} and {user_name}." ;
259+
260+ String result = InstructionUtils .injectSessionState (testContext , template ).blockingGet ();
261+
262+ assertThat (result ).isEqualTo ("Workflow syntax: ${{expression}} and bar." );
263+ }
223264}
0 commit comments