You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2015/06/10 18:30:17 UTC
svn commit: r1684706 [5/5] - in /commons/proper/jexl/trunk: ./
src/main/java/org/apache/commons/jexl3/
src/main/java/org/apache/commons/jexl3/annotations/
src/main/java/org/apache/commons/jexl3/internal/
src/main/java/org/apache/commons/jexl3/internal/...
Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/internal/introspection/DiscoveryTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/internal/introspection/DiscoveryTest.java?rev=1684706&r1=1684705&r2=1684706&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/internal/introspection/DiscoveryTest.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/internal/introspection/DiscoveryTest.java Wed Jun 10 16:30:16 2015
@@ -16,7 +16,6 @@
*/
package org.apache.commons.jexl3.internal.introspection;
-
import org.apache.commons.jexl3.JexlTestCase;
import org.apache.commons.jexl3.internal.Engine;
import org.apache.commons.jexl3.introspection.JexlPropertyGet;
@@ -26,6 +25,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Tests for checking introspection discovery.
@@ -40,10 +41,12 @@ public class DiscoveryTest extends JexlT
public static class Duck {
private String value;
private String eulav;
+
public Duck(String v, String e) {
value = v;
eulav = e;
}
+
public String get(String prop) {
if ("value".equals(prop)) {
return value;
@@ -53,6 +56,7 @@ public class DiscoveryTest extends JexlT
}
return "no such property";
}
+
public void set(String prop, String v) {
if ("value".equals(prop)) {
value = v;
@@ -66,87 +70,96 @@ public class DiscoveryTest extends JexlT
private String value;
private String eulav;
private boolean flag;
+
public Bean(String v, String e) {
value = v;
eulav = e;
flag = true;
}
+
public String getValue() {
return value;
}
+
public void setValue(String v) {
value = v;
}
+
public String getEulav() {
return eulav;
}
+
public void setEulav(String v) {
eulav = v;
}
+
public boolean isFlag() {
return flag;
}
+
public void setFlag(boolean f) {
flag = f;
}
}
-
+ @Test
public void testBeanIntrospection() throws Exception {
Uberspect uber = Engine.getUberspect(null);
Bean bean = new Bean("JEXL", "LXEJ");
JexlPropertyGet get = uber.getPropertyGet(bean, "value");
- JexlPropertySet set = uber.getPropertySet(bean, "value", "foo");
- assertTrue("bean property getter", get instanceof PropertyGetExecutor);
- assertTrue("bean property setter", set instanceof PropertySetExecutor);
+ JexlPropertySet set = uber.getPropertySet(bean, "value", "foo");
+ Assert.assertTrue("bean property getter", get instanceof PropertyGetExecutor);
+ Assert.assertTrue("bean property setter", set instanceof PropertySetExecutor);
// introspector and uberspect should return same result
- assertEquals(get, uber.getPropertyGet(bean, "value"));
- assertEquals(set, uber.getPropertySet(bean, "value", "foo"));
+ Assert.assertEquals(get, uber.getPropertyGet(bean, "value"));
+ Assert.assertEquals(set, uber.getPropertySet(bean, "value", "foo"));
// different property should return different setter/getter
- assertFalse(get.equals(uber.getPropertyGet(bean, "eulav")));
- assertFalse(set.equals(uber.getPropertySet(bean, "eulav", "foo")));
+ Assert.assertFalse(get.equals(uber.getPropertyGet(bean, "eulav")));
+ Assert.assertFalse(set.equals(uber.getPropertySet(bean, "eulav", "foo")));
// setter returns argument
Object bar = set.invoke(bean, "bar");
- assertEquals("bar", bar);
+ Assert.assertEquals("bar", bar);
// getter should return last value
- assertEquals("bar", get.invoke(bean));
+ Assert.assertEquals("bar", get.invoke(bean));
// tryExecute should succeed on same property
Object quux = set.tryInvoke(bean, "value", "quux");
- assertEquals("quux", quux);
- assertEquals("quux", get.invoke(bean));
+ Assert.assertEquals("quux", quux);
+ Assert.assertEquals("quux", get.invoke(bean));
// tryExecute should fail on different property
- assertEquals(AbstractExecutor.TRY_FAILED, set.tryInvoke(bean, "eulav", "nope"));
+ Assert.assertEquals(AbstractExecutor.TRY_FAILED, set.tryInvoke(bean, "eulav", "nope"));
}
+ @Test
public void testDuckIntrospection() throws Exception {
Uberspect uber = Engine.getUberspect(null);
Duck duck = new Duck("JEXL", "LXEJ");
JexlPropertyGet get = uber.getPropertyGet(duck, "value");
- JexlPropertySet set = uber.getPropertySet(duck, "value", "foo");
- assertTrue("duck property getter", get instanceof DuckGetExecutor);
- assertTrue("duck property setter", set instanceof DuckSetExecutor);
+ JexlPropertySet set = uber.getPropertySet(duck, "value", "foo");
+ Assert.assertTrue("duck property getter", get instanceof DuckGetExecutor);
+ Assert.assertTrue("duck property setter", set instanceof DuckSetExecutor);
// introspector and uberspect should return same result
- assertEquals(get, uber.getPropertyGet(duck, "value"));
- assertEquals(set, uber.getPropertySet(duck, "value", "foo"));
+ Assert.assertEquals(get, uber.getPropertyGet(duck, "value"));
+ Assert.assertEquals(set, uber.getPropertySet(duck, "value", "foo"));
// different property should return different setter/getter
- assertFalse(get.equals(uber.getPropertyGet(duck, "eulav")));
- assertFalse(set.equals(uber.getPropertySet(duck, "eulav", "foo")));
+ Assert.assertFalse(get.equals(uber.getPropertyGet(duck, "eulav")));
+ Assert.assertFalse(set.equals(uber.getPropertySet(duck, "eulav", "foo")));
// setter returns argument
Object bar = set.invoke(duck, "bar");
- assertEquals("bar", bar);
+ Assert.assertEquals("bar", bar);
// getter should return last value
- assertEquals("bar", get.invoke(duck));
+ Assert.assertEquals("bar", get.invoke(duck));
// tryExecute should succeed on same property
Object quux = set.tryInvoke(duck, "value", "quux");
- assertEquals("quux", quux);
- assertEquals("quux", get.invoke(duck));
+ Assert.assertEquals("quux", quux);
+ Assert.assertEquals("quux", get.invoke(duck));
// tryExecute should fail on different property
- assertEquals(AbstractExecutor.TRY_FAILED, set.tryInvoke(duck, "eulav", "nope"));
+ Assert.assertEquals(AbstractExecutor.TRY_FAILED, set.tryInvoke(duck, "eulav", "nope"));
}
+ @Test
public void testListIntrospection() throws Exception {
Uberspect uber = Engine.getUberspect(null);
List<Object> list = new ArrayList<Object>();
@@ -154,29 +167,30 @@ public class DiscoveryTest extends JexlT
list.add("TSIL");
JexlPropertyGet get = uber.getPropertyGet(list, Integer.valueOf(1));
- JexlPropertySet set = uber.getPropertySet(list, Integer.valueOf(1), "foo");
- assertTrue("list property getter", get instanceof ListGetExecutor);
- assertTrue("list property setter", set instanceof ListSetExecutor);
+ JexlPropertySet set = uber.getPropertySet(list, Integer.valueOf(1), "foo");
+ Assert.assertTrue("list property getter", get instanceof ListGetExecutor);
+ Assert.assertTrue("list property setter", set instanceof ListSetExecutor);
// introspector and uberspect should return same result
- assertEquals(get, uber.getPropertyGet(list, Integer.valueOf(1)));
- assertEquals(set, uber.getPropertySet(list, Integer.valueOf(1), "foo"));
+ Assert.assertEquals(get, uber.getPropertyGet(list, Integer.valueOf(1)));
+ Assert.assertEquals(set, uber.getPropertySet(list, Integer.valueOf(1), "foo"));
// different property should return different setter/getter
- assertFalse(get.equals(uber.getPropertyGet(list, Integer.valueOf(0))));
- assertFalse(get.equals(uber.getPropertySet(list, Integer.valueOf(0), "foo")));
+ Assert.assertFalse(get.equals(uber.getPropertyGet(list, Integer.valueOf(0))));
+ Assert.assertFalse(get.equals(uber.getPropertySet(list, Integer.valueOf(0), "foo")));
// setter returns argument
Object bar = set.invoke(list, "bar");
- assertEquals("bar", bar);
+ Assert.assertEquals("bar", bar);
// getter should return last value
- assertEquals("bar", get.invoke(list));
+ Assert.assertEquals("bar", get.invoke(list));
// tryExecute should succeed on integer property
Object quux = set.tryInvoke(list, Integer.valueOf(1), "quux");
- assertEquals("quux", quux);
+ Assert.assertEquals("quux", quux);
// getter should return last value
- assertEquals("quux", get.invoke(list));
+ Assert.assertEquals("quux", get.invoke(list));
// tryExecute should fail on non-integer property class
- assertEquals(AbstractExecutor.TRY_FAILED, set.tryInvoke(list, "eulav", "nope"));
+ Assert.assertEquals(AbstractExecutor.TRY_FAILED, set.tryInvoke(list, "eulav", "nope"));
}
+ @Test
public void testMapIntrospection() throws Exception {
Uberspect uber = Engine.getUberspect(null);
Map<String, Object> map = new HashMap<String, Object>();
@@ -184,27 +198,27 @@ public class DiscoveryTest extends JexlT
map.put("eulav", "PAM");
JexlPropertyGet get = uber.getPropertyGet(map, "value");
- JexlPropertySet set = uber.getPropertySet(map, "value", "foo");
- assertTrue("map property getter", get instanceof MapGetExecutor);
- assertTrue("map property setter", set instanceof MapSetExecutor);
+ JexlPropertySet set = uber.getPropertySet(map, "value", "foo");
+ Assert.assertTrue("map property getter", get instanceof MapGetExecutor);
+ Assert.assertTrue("map property setter", set instanceof MapSetExecutor);
// introspector and uberspect should return same result
- assertEquals(get, uber.getPropertyGet(map, "value"));
- assertEquals(set, uber.getPropertySet(map, "value", "foo"));
+ Assert.assertEquals(get, uber.getPropertyGet(map, "value"));
+ Assert.assertEquals(set, uber.getPropertySet(map, "value", "foo"));
// different property should return different setter/getter
- assertFalse(get.equals(uber.getPropertyGet(map, "eulav")));
- assertFalse(get.equals(uber.getPropertySet(map, "eulav", "foo")));
+ Assert.assertFalse(get.equals(uber.getPropertyGet(map, "eulav")));
+ Assert.assertFalse(get.equals(uber.getPropertySet(map, "eulav", "foo")));
// setter returns argument
Object bar = set.invoke(map, "bar");
- assertEquals("bar", bar);
+ Assert.assertEquals("bar", bar);
// getter should return last value
- assertEquals("bar", get.invoke(map));
+ Assert.assertEquals("bar", get.invoke(map));
// tryExecute should succeed on same property class
Object quux = set.tryInvoke(map, "value", "quux");
- assertEquals("quux", quux);
+ Assert.assertEquals("quux", quux);
// getter should return last value
- assertEquals("quux", get.invoke(map));
+ Assert.assertEquals("quux", get.invoke(map));
// tryExecute should fail on different property class
- assertEquals(AbstractExecutor.TRY_FAILED, set.tryInvoke(map, Integer.valueOf(1), "nope"));
+ Assert.assertEquals(AbstractExecutor.TRY_FAILED, set.tryInvoke(map, Integer.valueOf(1), "nope"));
}
}
Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/internal/introspection/MethodKeyTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/internal/introspection/MethodKeyTest.java?rev=1684706&r1=1684705&r2=1684706&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/internal/introspection/MethodKeyTest.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/internal/introspection/MethodKeyTest.java Wed Jun 10 16:30:16 2015
@@ -17,6 +17,7 @@
package org.apache.commons.jexl3.internal.introspection;
import junit.framework.TestCase;
+import org.junit.Test;
/**
* Checks the CacheMap.MethodKey implementation
@@ -139,6 +140,7 @@ public class MethodKeyTest extends TestC
assertTrue(out != null);
}
+ @Test
public void testObjectKey() throws Exception {
for (int k = 0; k < keyList.length; ++k) {
MethodKey ctl = keyList[k];
@@ -150,6 +152,7 @@ public class MethodKeyTest extends TestC
}
+ @Test
public void testStringKey() throws Exception {
for (int k = 0; k < keyList.length; ++k) {
MethodKey ctl = keyList[k];
@@ -162,6 +165,7 @@ public class MethodKeyTest extends TestC
}
private static final int LOOP = 3;//00;
+ @Test
public void testPerfKey() throws Exception {
for (int l = 0; l < LOOP; ++l) {
for (int k = 0; k < keyList.length; ++k) {
@@ -173,6 +177,7 @@ public class MethodKeyTest extends TestC
}
}
+ @Test
public void testPerfString() throws Exception {
for (int l = 0; l < LOOP; ++l) {
for (int k = 0; k < keyList.length; ++k) {
@@ -184,6 +189,7 @@ public class MethodKeyTest extends TestC
}
}
+ @Test
public void testPerfKey2() throws Exception {
for (int l = 0; l < LOOP; ++l) {
for (int m = 0; m < METHODS.length; ++m) {
@@ -201,6 +207,7 @@ public class MethodKeyTest extends TestC
}
}
+ @Test
public void testPerfStringKey2() throws Exception {
for (int l = 0; l < LOOP; ++l) {
for (int m = 0; m < METHODS.length; ++m) {
@@ -217,4 +224,4 @@ public class MethodKeyTest extends TestC
}
}
}
-}
\ No newline at end of file
+}
Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/introspection/SandboxTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/introspection/SandboxTest.java?rev=1684706&r1=1684705&r2=1684706&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/introspection/SandboxTest.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/introspection/SandboxTest.java Wed Jun 10 16:30:16 2015
@@ -28,9 +28,13 @@ import org.apache.commons.jexl3.annotati
import org.apache.log4j.Logger;
import org.apache.log4j.LogManager;
+import org.junit.Assert;
+import org.junit.Test;
+
/**
* Tests sandbox features.
*/
+@SuppressWarnings({"UnnecessaryBoxing", "AssertEqualsBetweenInconvertibleTypes"})
public class SandboxTest extends JexlTestCase {
static final Logger LOGGER = LogManager.getLogger(SandboxTest.class.getName());
@@ -63,7 +67,8 @@ public class SandboxTest extends JexlTes
String name;
public String alias;
- public @NoJexl Foo(String name, String notcallable) {
+ public @NoJexl
+ Foo(String name, String notcallable) {
throw new RuntimeException("should not be callable!");
}
@@ -100,12 +105,13 @@ public class SandboxTest extends JexlTes
}
}
+ @Test
public void testCtorBlack() throws Exception {
String expr = "new('" + Foo.class.getName() + "', '42')";
JexlScript script = JEXL.createScript(expr);
Object result;
result = script.execute(null);
- assertEquals("42", ((Foo) result).getName());
+ Assert.assertEquals("42", ((Foo) result).getName());
JexlSandbox sandbox = new JexlSandbox();
sandbox.black(Foo.class.getName()).execute("");
@@ -114,20 +120,21 @@ public class SandboxTest extends JexlTes
script = sjexl.createScript(expr);
try {
result = script.execute(null);
- fail("ctor should not be accessible");
+ Assert.fail("ctor should not be accessible");
} catch (JexlException.Method xmethod) {
// ok, ctor should not have been accessible
LOGGER.info(xmethod.toString());
}
}
+ @Test
public void testMethodBlack() throws Exception {
String expr = "foo.Quux()";
JexlScript script = JEXL.createScript(expr, "foo");
Foo foo = new Foo("42");
Object result;
result = script.execute(null, foo);
- assertEquals(foo.Quux(), result);
+ Assert.assertEquals(foo.Quux(), result);
JexlSandbox sandbox = new JexlSandbox();
sandbox.black(Foo.class.getName()).execute("Quux");
@@ -136,20 +143,21 @@ public class SandboxTest extends JexlTes
script = sjexl.createScript(expr, "foo");
try {
result = script.execute(null, foo);
- fail("Quux should not be accessible");
+ Assert.fail("Quux should not be accessible");
} catch (JexlException.Method xmethod) {
// ok, Quux should not have been accessible
LOGGER.info(xmethod.toString());
}
}
+ @Test
public void testGetBlack() throws Exception {
String expr = "foo.alias";
JexlScript script = JEXL.createScript(expr, "foo");
Foo foo = new Foo("42");
Object result;
result = script.execute(null, foo);
- assertEquals(foo.alias, result);
+ Assert.assertEquals(foo.alias, result);
JexlSandbox sandbox = new JexlSandbox();
sandbox.black(Foo.class.getName()).read("alias");
@@ -158,20 +166,21 @@ public class SandboxTest extends JexlTes
script = sjexl.createScript(expr, "foo");
try {
result = script.execute(null, foo);
- fail("alias should not be accessible");
+ Assert.fail("alias should not be accessible");
} catch (JexlException.Property xvar) {
// ok, alias should not have been accessible
LOGGER.info(xvar.toString());
}
}
+ @Test
public void testSetBlack() throws Exception {
String expr = "foo.alias = $0";
JexlScript script = JEXL.createScript(expr, "foo", "$0");
Foo foo = new Foo("42");
Object result;
result = script.execute(null, foo, "43");
- assertEquals("43", result);
+ Assert.assertEquals("43", result);
JexlSandbox sandbox = new JexlSandbox();
sandbox.black(Foo.class.getName()).write("alias");
@@ -180,13 +189,14 @@ public class SandboxTest extends JexlTes
script = sjexl.createScript(expr, "foo", "$0");
try {
result = script.execute(null, foo, "43");
- fail("alias should not be accessible");
+ Assert.fail("alias should not be accessible");
} catch (JexlException.Property xvar) {
// ok, alias should not have been accessible
LOGGER.info(xvar.toString());
}
}
+ @Test
public void testCtorWhite() throws Exception {
String expr = "new('" + Foo.class.getName() + "', '42')";
JexlScript script;
@@ -198,9 +208,10 @@ public class SandboxTest extends JexlTes
script = sjexl.createScript(expr);
result = script.execute(null);
- assertEquals("42", ((Foo) result).getName());
+ Assert.assertEquals("42", ((Foo) result).getName());
}
+ @Test
public void testMethodWhite() throws Exception {
Foo foo = new Foo("42");
String expr = "foo.Quux()";
@@ -213,9 +224,10 @@ public class SandboxTest extends JexlTes
script = sjexl.createScript(expr, "foo");
result = script.execute(null, foo);
- assertEquals(foo.Quux(), result);
+ Assert.assertEquals(foo.Quux(), result);
}
+ @Test
public void testMethodNoJexl() throws Exception {
Foo foo = new Foo("42");
String[] exprs = {
@@ -234,7 +246,7 @@ public class SandboxTest extends JexlTes
script = sjexl.createScript(expr, "foo");
try {
result = script.execute(null, foo);
- fail("should have not been possible");
+ Assert.fail("should have not been possible");
} catch (JexlException.Method xjm) {
// ok
LOGGER.info(xjm.toString());
@@ -245,6 +257,7 @@ public class SandboxTest extends JexlTes
}
}
+ @Test
public void testGetWhite() throws Exception {
Foo foo = new Foo("42");
String expr = "foo.alias";
@@ -258,13 +271,14 @@ public class SandboxTest extends JexlTes
script = sjexl.createScript(expr, "foo");
result = script.execute(null, foo);
- assertEquals(foo.alias, result);
+ Assert.assertEquals(foo.alias, result);
script = sjexl.createScript("foo.ALIAS", "foo");
result = script.execute(null, foo);
- assertEquals(foo.alias, result);
+ Assert.assertEquals(foo.alias, result);
}
+ @Test
public void testSetWhite() throws Exception {
Foo foo = new Foo("42");
String expr = "foo.alias = $0";
@@ -277,10 +291,11 @@ public class SandboxTest extends JexlTes
script = sjexl.createScript(expr, "foo", "$0");
result = script.execute(null, foo, "43");
- assertEquals("43", result);
- assertEquals("43", foo.alias);
+ Assert.assertEquals("43", result);
+ Assert.assertEquals("43", foo.alias);
}
+ @Test
public void testRestrict() throws Exception {
JexlContext context = new MapContext();
context.set("System", System.class);
@@ -295,11 +310,11 @@ public class SandboxTest extends JexlTes
String expr;
JexlScript script;
Object result;
-
+
script = sjexl.createScript("System.exit()");
try {
result = script.execute(context);
- fail("should not allow calling exit!");
+ Assert.fail("should not allow calling exit!");
} catch (JexlException xjexl) {
LOGGER.info(xjexl.toString());
}
@@ -307,7 +322,7 @@ public class SandboxTest extends JexlTes
script = sjexl.createScript("System.exit(1)");
try {
result = script.execute(context);
- fail("should not allow calling exit!");
+ Assert.fail("should not allow calling exit!");
} catch (JexlException xjexl) {
LOGGER.info(xjexl.toString());
}
@@ -315,7 +330,7 @@ public class SandboxTest extends JexlTes
script = sjexl.createScript("new('java.io.File', '/tmp/should-not-be-created')");
try {
result = script.execute(context);
- fail("should not allow creating a file");
+ Assert.fail("should not allow creating a file");
} catch (JexlException xjexl) {
LOGGER.info(xjexl.toString());
}
@@ -323,6 +338,6 @@ public class SandboxTest extends JexlTes
expr = "System.currentTimeMillis()";
script = sjexl.createScript("System.currentTimeMillis()");
result = script.execute(context);
- assertNotNull(result);
+ Assert.assertNotNull(result);
}
}
Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/junit/AsserterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/junit/AsserterTest.java?rev=1684706&r1=1684705&r2=1684706&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/junit/AsserterTest.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/junit/AsserterTest.java Wed Jun 10 16:30:16 2015
@@ -21,32 +21,35 @@ import junit.framework.AssertionFailedEr
import org.apache.commons.jexl3.Foo;
import org.apache.commons.jexl3.JexlTestCase;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Simple testcases
*
* @since 1.0
*/
+@SuppressWarnings({"UnnecessaryBoxing", "AssertEqualsBetweenInconvertibleTypes"})
public class AsserterTest extends JexlTestCase {
- public AsserterTest(String testName) {
- super(testName);
+ public AsserterTest() {
+ super("AsserterTest");
}
+ @Test
public void testThis() throws Exception {
Asserter asserter = new Asserter(JEXL);
asserter.setVariable("this", new Foo());
-
asserter.assertExpression("this.get('abc')", "Repeat : abc");
-
try {
asserter.assertExpression("this.count", "Wrong Value");
- fail("This method should have thrown an assertion exception");
+ Assert.fail("This method should have thrown an assertion exception");
}
catch (AssertionFailedError e) {
// it worked!
}
}
+ @Test
public void testVariable() throws Exception {
Asserter asserter = new Asserter(JEXL);
asserter.setSilent(true);
@@ -61,7 +64,7 @@ public class AsserterTest extends JexlTe
try {
asserter.assertExpression("bar.count", new Integer(5));
- fail("This method should have thrown an assertion exception");
+ Assert.fail("This method should have thrown an assertion exception");
}
catch (AssertionFailedError e) {
// it worked!
Added: commons/proper/jexl/trunk/src/test/scripts/testA.jexl
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/scripts/testA.jexl?rev=1684706&view=auto
==============================================================================
--- commons/proper/jexl/trunk/src/test/scripts/testA.jexl (added)
+++ commons/proper/jexl/trunk/src/test/scripts/testA.jexl Wed Jun 10 16:30:16 2015
@@ -0,0 +1,16 @@
+$out.println("Start Script Prompt Dependencies");
+//attention company doit être multivalué
+/*var vCountry = $in['company'];
+$out.add("The user input is the following: ");
+for (var g : members(vCountry))
+{
+ $out.add("Country: " + name(g));
+}*/
+
+var vCountry = $in['company'];
+var vResp = $in['responsible'];
+{
+ $out.add("Then, " + vResp.name + " is responsible for : " + vCountry.name);
+}
+
+$out.println("Stop Script Prompt Dependencies");