public static void bindEnvironment(ScriptEngine engine, String requestContent, Map<String, Object> requestContext,
         StateStore stateStore) {
      // Build a map of header values.
      bindEnvironment(engine, requestContent, requestContext, stateStore, null);
   }
@Test
   void testRequestContextIsModified() {
      String script = """
            requestContext.foo = "bar";
            return mockRequest.requestContent;
            """;

      ScriptEngineManager sem = new ScriptEngineManager();
      Map<String, Object> context = new HashMap<>();
      String body = "content";

      try {
         // Evaluating request with script coming from operation dispatcher rules.
         ScriptEngine se = sem.getEngineByExtension("groovy");
         ScriptEngineBinder.bindEnvironment(se, body, context, null);
         String result = (String) se.eval(script);

         assertEquals(body, result);
         assertTrue(context.containsKey("foo"));
         assertEquals("bar", context.get("foo"));
      } catch (Exception e) {
         fail("Exception should no be thrown");
      }
   }