Created
January 21, 2012 02:32
-
-
Save uphy/1650852 to your computer and use it in GitHub Desktop.
Example of prms and jmatx combination.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 関数を注入するテストを行います。 | |
* | |
* @throws Exception テスト失敗 | |
*/ | |
@SuppressWarnings("boxing") | |
@Test | |
public void testInvocableWithInitialValue() throws Exception { | |
class A { | |
@ParameterMember | |
@Scriptable(initialValue = "Func void sum(Integer a,Integer b){return a+b;}") | |
Invocable invocable; | |
} | |
A a = new A(); | |
final Parameterizer p = new DefaultParameterizer(new DefaultParameterFactory(new JMatxScriptEngine())); | |
p.parameterize(a); | |
final Invocable sum = a.invocable; | |
assertEquals(2, sum.invoke(null, 1, 1)); | |
assertEquals(3, sum.invoke(null, 1, 2)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment