protected static List<UnidirectionalEvent> parseUnidirectionalEventTemplateOutput(String content) throws Exception {
      List<UnidirectionalEvent> results = new ArrayList<>();

      JsonNode root = YAML_MAPPER.readTree(sanitizeYamlContent(content));
      if (root.getNodeType() == JsonNodeType.ARRAY) {
         Iterator<JsonNode> examples = root.elements();
         while (examples.hasNext()) {
            JsonNode example = examples.next();

            // Deal with parsing message.
            JsonNode message = example.path("message");
            EventMessage event = new EventMessage();
            JsonNode headersNode = message.path(HEADERS_NODE);
            event.setHeaders(buildHeaders(headersNode));
            event.setMediaType("application/json");
            event.setContent(getMessageContent("application/json", message.path("payload")));

            results.add(new UnidirectionalEvent(event));
         }
      }
      return results;
   }
@Test
   void testParseEventMessageOutputYaml() {
      String aiResponse = """
            - example: 1
              message:
                headers:
                  my-app-header: 42
                payload:
                  id: "12345"
                  sendAt: "2022-01-01T10:00:00Z"
                  fullName: "John Doe"
                  email: "john.doe@example.com"
                  age: 25

            - example: 2
              message:
                headers:
                  my-app-header: 75
                payload:
                  id: "98765"
                  sendAt: "2022-01-02T14:30:00Z"
                  fullName: "Jane Smith"
                  email: "jane.smith@example.com"
                  age: 28
            """;

      Service service = new Service();
      service.setType(ServiceType.EVENT);
      Operation operation = new Operation();
      operation.setName("SUBSCRIBE user/signedup");

      List<UnidirectionalEvent> results = null;
      try {
         results = AICopilotHelper.parseUnidirectionalEventTemplateOutput(aiResponse);
      } catch (Exception e) {
         fail("Exception should not be thrown here");
      }

      assertNotNull(results);
      assertEquals(2, results.size());

      // Check that message 1 has been correctly parsed.
      EventMessage event1 = results.get(0).getEventMessage();
      assertEquals(1, event1.getHeaders().size());
      assertNotNull(event1.getContent());
   }