@@ -0,0 +1,1814 @@
+package com.github.ansell.csvmap;%0A%0Aimport static org.junit.Assert.*;%0A%0Aimport java.util.List;%0A%0Aimport javax.script.Bindings;%0Aimport javax.script.Compilable;%0Aimport javax.script.CompiledScript;%0Aimport javax.script.ScriptEngine;%0Aimport javax.script.ScriptEngineFactory;%0Aimport javax.script.ScriptEngineManager;%0A%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Apublic class ScriptEngineTest %7B%0A%0A%09private static final ScriptEngineManager SCRIPT_MANAGER = new ScriptEngineManager();%0A%0A%09// Uncomment the following to debug which script engines are available on%0A%09// the classpath%0A%09static %7B%0A%09%09List%3CScriptEngineFactory%3E factories = SCRIPT_MANAGER.getEngineFactories();%0A%0A%09%09System.out.println(%22Installed script engines:%22);%0A%0A%09%09for (ScriptEngineFactory nextFactory : factories) %7B%0A%09%09%09System.out.println(nextFactory.getEngineName());%0A%09%09%7D%0A%09%7D%0A%0A%09private ScriptEngine scriptEngine;%0A%0A%09@Before%0A%09public void setUp() throws Exception %7B%0A%09%09scriptEngine = SCRIPT_MANAGER.getEngineByName(%22lua%22);%0A%09%7D%0A%0A%09@After%0A%09public void tearDown() throws Exception %7B%0A%09%7D%0A%0A%09@Test%0A%09public final void test() throws Exception %7B%0A%09%09String csvMapperScript = %22mapFunction = function(inputHeaders, inputField, inputValue, outputField, line) return inputValue end%22;%0A%09%09String simpleScript = %22return inputValue%22;%0A%09%09CompiledScript compiledScript = (CompiledScript) ((Compilable) scriptEngine).compile(simpleScript);%0A%09%09Bindings bindings = scriptEngine.createBindings();%0A%09%09// inputHeaders, inputField, inputValue, outputField, line%0A%09%09bindings.put(%22inputHeaders%22, %22%22);%0A%09%09bindings.put(%22inputField%22, %22%22);%0A%09%09bindings.put(%22inputValue%22, %22testreturnvalue%22);%0A%09%09bindings.put(%22outputField%22, %22%22);%0A%09%09bindings.put(%22line%22, %22%22);%0A%09%09String result = (String) compiledScript.eval(bindings);%0A%09%09System.out.println(result);%0A%09%09assertEquals(%22testreturnvalue%22, result);%0A%09%7D%0A%0A%7D%0A

Add test for the way the Lua functionality should work