@Test
    public void testGeneratorWithStringInputStructOutput() {
        Map<String, FieldGenerator> generators = Map.of("generator", new StructMockGenerator());
        
        var expressionString = "input myText | generate | attribute myStruct";
        var input = "value1 value2";

        var expression = expressionFrom(generators, expressionString);
        
        SimpleTestAdapter adapter = new SimpleTestAdapter();

        var inputField = new Field("myText", DataType.STRING);
        adapter.createField(inputField);

        var structDataType = new StructDataType("myStructType");
        structDataType.addField(new Field("myField1", DataType.STRING));
        structDataType.addField(new Field("myField2", DataType.STRING));
        var outputField = new Field("myStruct", structDataType);
        adapter.createField(outputField);
        
        adapter.setValue("myText", new StringFieldValue(input));
        expression.setStatementOutput(new DocumentType("myDocument"), outputField);
        expression.resolve(new TypeContext(adapter));

        ExecutionContext context = new ExecutionContext(adapter);
        expression.execute(context);
        
        var generatedValue = (StructuredFieldValue) adapter.values.get("myStruct");
        assertEquals("value1", generatedValue.getFieldValue("myField1").toString());
        assertEquals("value2", generatedValue.getFieldValue("myField2").toString());
    }
Tests a common use case where an array is generated from one text input.
indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/GenerateExpressionTestCase.java