commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1209876 - /commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/scripting/JexlScriptEngineTest.java
Date Sat, 03 Dec 2011 10:03:01 GMT
Author: sebb
Date: Sat Dec  3 10:03:01 2011
New Revision: 1209876

URL: http://svn.apache.org/viewvc?rev=1209876&view=rev
Log:
Allow test to work with both versions of Jexl

Modified:
    commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/scripting/JexlScriptEngineTest.java

Modified: commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/scripting/JexlScriptEngineTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/scripting/JexlScriptEngineTest.java?rev=1209876&r1=1209875&r2=1209876&view=diff
==============================================================================
--- commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/scripting/JexlScriptEngineTest.java
(original)
+++ commons/proper/jexl/branches/COMMONS_JEXL_2_0_1_TEST/src/test/java/org/apache/commons/jexl2/scripting/JexlScriptEngineTest.java
Sat Dec  3 10:03:01 2011
@@ -31,14 +31,24 @@ public class JexlScriptEngineTest extend
     public void testScriptEngineFactory() throws Exception {
         JexlScriptEngineFactory factory = new JexlScriptEngineFactory();
         assertEquals("JEXL Engine", factory.getParameter(ScriptEngine.ENGINE));
-        assertEquals("2.0", factory.getParameter(ScriptEngine.ENGINE_VERSION)); // 2.1 ;
version 2.0 supports jexl2
+        Object parameter = factory.getParameter(ScriptEngine.ENGINE_VERSION);
+        boolean testing21 = false; // are we testing 2.1?
+        if ("2.0".equals(parameter)) {
+            testing21 = true;
+        }
         assertEquals("JEXL", factory.getParameter(ScriptEngine.LANGUAGE));
         assertEquals("2.0", factory.getParameter(ScriptEngine.LANGUAGE_VERSION));
-        assertEquals(Arrays.asList("JEXL", "Jexl", "jexl", "JEXL2", "Jexl2", "jexl2"), factory.getParameter(ScriptEngine.NAME));
-        assertNull(factory.getParameter("THREADING"));
+        if (testing21) {
+            assertEquals(Arrays.asList("JEXL", "Jexl", "jexl", "JEXL2", "Jexl2", "jexl2"),
factory.getParameter(ScriptEngine.NAME));            
+            assertEquals(Arrays.asList("jexl", "jexl2"), factory.getExtensions());
+            assertEquals(Arrays.asList("application/x-jexl", "application/x-jexl2"), factory.getMimeTypes());
+        } else {
+            assertEquals(Arrays.asList("JEXL", "Jexl", "jexl"), factory.getParameter(ScriptEngine.NAME));
+            assertEquals(Arrays.asList("jexl"), factory.getExtensions());
+            assertEquals(Arrays.asList("application/x-jexl"), factory.getMimeTypes());
+        }
 
-        assertEquals(Arrays.asList("jexl", "jexl2"), factory.getExtensions());
-        assertEquals(Arrays.asList("application/x-jexl", "application/x-jexl2"), factory.getMimeTypes());
+        assertNull(factory.getParameter("THREADING"));
 
         assertEquals("42;", factory.getProgram(new String[]{"42"}));
         assertEquals("str.substring(3,4)", factory.getMethodCallSyntax("str", "substring",
new String[]{"3", "4"}));



Mime
View raw message