@Test
    public void testChoiceExpression() {
        var tester = new ScriptTester();
        // Nonsensical expression whose purpose is to test cat being given any as output type
        var expression = tester.expressionFrom("(get_var A | to_array) . (get_var B | to_array) | get_var B | to_array | index myStringArray");

        SimpleTestAdapter adapter = new SimpleTestAdapter();
        adapter.createField(new Field("myStringArray", ArrayDataType.getArray(DataType.STRING)));

        var verificationContext = new TypeContext(adapter);
        verificationContext.setVariableType("A", DataType.STRING);
        verificationContext.setVariableType("B", DataType.STRING);
        expression.resolve(verificationContext);

        var context = new ExecutionContext(adapter);
        context.setVariable("B", new StringFieldValue("b_value"));
        expression.execute(context);
        assertEquals("b_value", ((Array)adapter.values.get("myStringArray")).get(0).toString());
    }
@author Simon Thoresen Hult
@author bratseth
indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/ScriptTestCase.java