Author: sebb
Date: Mon Jan 20 18:18:00 2014
New Revision: 1559796
URL: http://svn.apache.org/r1559796
Log:
Ensure Continuum test passes (SCXML-188)
Modified:
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSEvaluatorTest.java
Modified:
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSEvaluatorTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSEvaluatorTest.java?rev=1559796&r1=1559795&r2=1559796&view=diff
==============================================================================
---
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSEvaluatorTest.java
(original)
+++
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSEvaluatorTest.java
Mon Jan 20 18:18:00 2014
@@ -76,6 +76,7 @@ public class JSEvaluatorTest {
new TestItem("1 + 1 + 2 + 3 + 5", new Double(12)),
new TestItem("(1 + 1 + 2 + 3 + 5) == 12", new Boolean(true)),
new TestItem("(1 + 1 + 2 + 3 + 5) == 13", new Boolean(false)),
+ new TestItem("1.0 + 1.0 + 2.0 + 3.0 + 5.0", new Double(12.0)),
};
private static final TestItem[] VAR_EXPRESSIONS = {
@@ -181,9 +182,19 @@ public class JSEvaluatorTest {
public void testStandardExpressions() throws Exception {
for (TestItem item: SIMPLE_EXPRESSIONS) {
Object eval = evaluator.eval(context,item.expression);
- Assert.assertEquals("Invalid result: " + item.expression,
- item.result,
- eval);
+ // Allow for OpenJDK 1.6 which returns Integer instead of Double
+ if (eval instanceof Integer && item.result instanceof Number) {
+ Assert.assertEquals("Invalid result: " + item.expression,
+ ((Number) item.result).intValue(),
+ ((Number) eval).intValue());
+ if (!(item.result instanceof Integer)) {
+ System.err.println("Expected: " +
item.result.getClass().getCanonicalName() + ", actual: Integer");
+ }
+ } else {
+ Assert.assertEquals("Invalid result: " + item.expression,
+ item.result,
+ eval);
+ }
}
}