@Test public void testExpose() throws Exception { Method hi = functions.resolveFunction("test", "hi"); assertEquals("hi", hi.invoke(null)); Method hiAlternate = functions.resolveFunction("test", "hola"); assertEquals("hi", hiAlternate.invoke(null)); Method bonjour = functions.resolveFunction("other", "bonjour"); assertEquals("French hello", bonjour.invoke(null)); }
@Test public void testExpose() throws Exception { Method hi = functions.resolveFunction("test", "hi"); assertEquals("hi", hi.invoke(null)); Method hiAlternate = functions.resolveFunction("test", "hola"); assertEquals("hi", hiAlternate.invoke(null)); Method bonjour = functions.resolveFunction("other", "bonjour"); assertEquals("French hello", bonjour.invoke(null)); }
@Test public void testExpose() throws Exception { Method hi = functions.resolveFunction("test", "hi"); assertEquals("hi", hi.invoke(null)); Method hiAlternate = functions.resolveFunction("test", "hola"); assertEquals("hi", hiAlternate.invoke(null)); Method bonjour = functions.resolveFunction("other", "bonjour"); assertEquals("French hello", bonjour.invoke(null)); }
@Test public void testExpose() throws Exception { Method hi = functions.resolveFunction("test", "hi"); assertEquals("hi", hi.invoke(null)); Method hiAlternate = functions.resolveFunction("test", "hola"); assertEquals("hi", hiAlternate.invoke(null)); Method bonjour = functions.resolveFunction("other", "bonjour"); assertEquals("French hello", bonjour.invoke(null)); }
@Test public void testExpose() throws Exception { Method hi = functions.resolveFunction("test", "hi"); assertEquals("hi", hi.invoke(null)); Method hiAlternate = functions.resolveFunction("test", "hola"); assertEquals("hi", hiAlternate.invoke(null)); Method bonjour = functions.resolveFunction("other", "bonjour"); assertEquals("French hello", bonjour.invoke(null)); }
@Test public void testDefaultBinding() throws Exception { Injector injector = Guice.createInjector(); functions = injector.getInstance(Functions.class); Method toJson = functions.resolveFunction("osx", "parseJson"); Object o = toJson.invoke(null, "{a : 1}"); assertTrue(o instanceof JSONObject); assertEquals(1, ((JSONObject) o).getInt("a")); }
@Test public void testDefaultBinding() throws Exception { Injector injector = Guice.createInjector(); functions = injector.getInstance(Functions.class); Method toJson = functions.resolveFunction("osx", "parseJson"); Object o = toJson.invoke(null, "{a : 1}"); assertTrue(o instanceof JSONObject); assertEquals(1, ((JSONObject) o).getInt("a")); }
@Test public void testDefaultBinding() throws Exception { Injector injector = Guice.createInjector(); functions = injector.getInstance(Functions.class); Method toJson = functions.resolveFunction("osx", "parseJson"); Object o = toJson.invoke(null, "{a : 1}"); assertTrue(o instanceof JSONObject); assertEquals(1, ((JSONObject) o).getInt("a")); }
@Test public void testDefaultBinding() throws Exception { Injector injector = Guice.createInjector(); functions = injector.getInstance(Functions.class); Method toJson = functions.resolveFunction("osx", "parseJson"); Object o = toJson.invoke(null, "{a : 1}"); assertTrue(o instanceof JSONObject); assertEquals(1, ((JSONObject) o).getInt("a")); }
@Test public void testDefaultBinding() throws Exception { Injector injector = Guice.createInjector(); functions = injector.getInstance(Functions.class); Method toJson = functions.resolveFunction("osx", "parseJson"); Object o = toJson.invoke(null, "{a : 1}"); assertTrue(o instanceof JSONObject); assertEquals(1, ((JSONObject) o).getInt("a")); }
@Test public void testExpressionEvaluation() { Expressions expressions = Expressions.forTesting(functions); ELContext context = expressions.newELContext(); ValueExpression expression = expressions.parse("${other:bonjour()}", String.class); assertEquals("French hello", expression.getValue(context)); expression = expressions.parse("${test:add(1, 2)}", Integer.class); assertEquals(3, expression.getValue(context)); }
@Test public void testExpressionEvaluation() { Expressions expressions = Expressions.forTesting(functions); ELContext context = expressions.newELContext(); ValueExpression expression = expressions.parse("${other:bonjour()}", String.class); assertEquals("French hello", expression.getValue(context)); expression = expressions.parse("${test:add(1, 2)}", Integer.class); assertEquals(3, expression.getValue(context)); }
@Test public void testExpressionEvaluation() { Expressions expressions = Expressions.forTesting(functions); ELContext context = expressions.newELContext(); ValueExpression expression = expressions.parse("${other:bonjour()}", String.class); assertEquals("French hello", expression.getValue(context)); expression = expressions.parse("${test:add(1, 2)}", Integer.class); assertEquals(3, expression.getValue(context)); }
@Test public void testExpressionEvaluation() { Expressions expressions = Expressions.forTesting(functions); ELContext context = expressions.newELContext(); ValueExpression expression = expressions.parse("${other:bonjour()}", String.class); assertEquals("French hello", expression.getValue(context)); expression = expressions.parse("${test:add(1, 2)}", Integer.class); assertEquals(3, expression.getValue(context)); }
@Test public void testExpressionEvaluation() { Expressions expressions = Expressions.forTesting(functions); ELContext context = expressions.newELContext(); ValueExpression expression = expressions.parse("${other:bonjour()}", String.class); assertEquals("French hello", expression.getValue(context)); expression = expressions.parse("${test:add(1, 2)}", Integer.class); assertEquals(3, expression.getValue(context)); }