|
46 | 46 | import static org.junit.Assert.*;
|
47 | 47 |
|
48 | 48 | /**
|
49 |
| - * Checks the behaviour of the SpelCompiler. |
50 |
| - * This should cover compilation all compiled node types. |
| 49 | + * Checks SpelCompiler behavior. This should cover compilation all compiled node types. |
51 | 50 | *
|
52 | 51 | * @author Andy Clement
|
53 | 52 | * @since 4.1
|
@@ -320,9 +319,8 @@ public void realLiteral() throws Exception {
|
320 | 319 | double resultI = expression.getValue(new TestClass1(), Double.TYPE);
|
321 | 320 | assertCanCompile(expression);
|
322 | 321 | double resultC = expression.getValue(new TestClass1(), Double.TYPE);
|
323 |
| - assertEquals(3.4d, resultI,0.1d); |
324 |
| - assertEquals(3.4d, resultC,0.1d); |
325 |
| - |
| 322 | + assertEquals(3.4d, resultI, 0.1d); |
| 323 | + assertEquals(3.4d, resultC, 0.1d); |
326 | 324 | assertEquals(3.4d, expression.getValue());
|
327 | 325 | }
|
328 | 326 |
|
@@ -455,13 +453,12 @@ public void intLiteral() throws Exception {
|
455 | 453 | assertCanCompile(expression);
|
456 | 454 | assertEquals(new Integer(42), expression.getValue(Integer.class));
|
457 | 455 |
|
458 |
| - // Code gen is different for -1 .. 6 because there are bytecode instructions specifically for those |
459 |
| - // values |
| 456 | + // Code gen is different for -1 .. 6 because there are bytecode instructions specifically for those values |
460 | 457 |
|
461 | 458 | // Not an int literal but an opminus with one operand:
|
462 |
| -// expression = parser.parseExpression("-1"); |
463 |
| -// assertCanCompile(expression); |
464 |
| -// assertEquals(-1, expression.getValue()); |
| 459 | + // expression = parser.parseExpression("-1"); |
| 460 | + // assertCanCompile(expression); |
| 461 | + // assertEquals(-1, expression.getValue()); |
465 | 462 | expression = parser.parseExpression("0");
|
466 | 463 | assertCanCompile(expression);
|
467 | 464 | assertEquals(0, expression.getValue());
|
@@ -506,8 +503,8 @@ public void floatLiteral() throws Exception {
|
506 | 503 | float resultI = expression.getValue(new TestClass1(), Float.TYPE);
|
507 | 504 | assertCanCompile(expression);
|
508 | 505 | float resultC = expression.getValue(new TestClass1(), Float.TYPE);
|
509 |
| - assertEquals(3.4f, resultI,0.1f); |
510 |
| - assertEquals(3.4f, resultC,0.1f); |
| 506 | + assertEquals(3.4f, resultI, 0.1f); |
| 507 | + assertEquals(3.4f, resultC, 0.1f); |
511 | 508 |
|
512 | 509 | assertEquals(3.4f, expression.getValue());
|
513 | 510 | }
|
@@ -3293,10 +3290,10 @@ public void constructorReference() throws Exception {
|
3293 | 3290 | assertCanCompile(expression);
|
3294 | 3291 | Object o = expression.getValue();
|
3295 | 3292 | assertEquals(testclass8,o.getClass().getName());
|
3296 |
| - TestClass8 tc8 = (TestClass8)o; |
| 3293 | + TestClass8 tc8 = (TestClass8) o; |
3297 | 3294 | assertEquals(42, tc8.i);
|
3298 | 3295 | assertEquals("123", tc8.s);
|
3299 |
| - assertEquals(4.0d, tc8.d,0.5d); |
| 3296 | + assertEquals(4.0d, tc8.d, 0.5d); |
3300 | 3297 | assertEquals(true, tc8.z);
|
3301 | 3298 |
|
3302 | 3299 | // no-arg ctor
|
@@ -4351,15 +4348,16 @@ public void mixingItUp_propertyAccessIndexerOpLtTernaryRootNull() throws Excepti
|
4351 | 4348 |
|
4352 | 4349 | expression = parser.parseExpression("DR[0].three");
|
4353 | 4350 | Object v = expression.getValue(payload);
|
4354 |
| - assertEquals("Lorg/springframework/expression/spel/SpelCompilationCoverageTests$Three", getAst().getExitDescriptor()); |
| 4351 | + assertEquals("Lorg/springframework/expression/spel/SpelCompilationCoverageTests$Three", |
| 4352 | + getAst().getExitDescriptor()); |
4355 | 4353 |
|
4356 | 4354 | Expression expression = parser.parseExpression("DR[0].three.four lt 0.1d?#root:null");
|
4357 | 4355 | v = expression.getValue(payload);
|
4358 | 4356 |
|
4359 | 4357 | SpelExpression sExpr = (SpelExpression) expression;
|
4360 | 4358 | Ternary ternary = (Ternary) sExpr.getAST();
|
4361 | 4359 | OpLT oplt = (OpLT) ternary.getChild(0);
|
4362 |
| - CompoundExpression cExpr = (CompoundExpression)oplt.getLeftOperand(); |
| 4360 | + CompoundExpression cExpr = (CompoundExpression) oplt.getLeftOperand(); |
4363 | 4361 | String cExprExitDescriptor = cExpr.getExitDescriptor();
|
4364 | 4362 | assertEquals("D", cExprExitDescriptor);
|
4365 | 4363 | assertEquals("Z", oplt.getExitDescriptor());
|
@@ -4599,14 +4597,16 @@ public void compilerWithGenerics_12040_3() {
|
4599 | 4597 |
|
4600 | 4598 | @Test
|
4601 | 4599 | public void indexerMapAccessor_12045() throws Exception {
|
4602 |
| - SpelParserConfiguration spc = new SpelParserConfiguration(SpelCompilerMode.IMMEDIATE,getClass().getClassLoader()); |
| 4600 | + SpelParserConfiguration spc = new SpelParserConfiguration( |
| 4601 | + SpelCompilerMode.IMMEDIATE,getClass().getClassLoader()); |
4603 | 4602 | SpelExpressionParser sep = new SpelExpressionParser(spc);
|
4604 | 4603 | expression=sep.parseExpression("headers[command]");
|
4605 | 4604 | MyMessage root = new MyMessage();
|
4606 | 4605 | assertEquals("wibble", expression.getValue(root));
|
4607 |
| - // This next call was failing because the isCompilable check in Indexer did not check on the key being compilable |
4608 |
| - // (and also generateCode in the Indexer was missing the optimization that it didn't need necessarily need to call |
4609 |
| - // generateCode for that accessor) |
| 4606 | + // This next call was failing because the isCompilable check in Indexer |
| 4607 | + // did not check on the key being compilable (and also generateCode in the |
| 4608 | + // Indexer was missing the optimization that it didn't need necessarily |
| 4609 | + // need to call generateCode for that accessor) |
4610 | 4610 | assertEquals("wibble", expression.getValue(root));
|
4611 | 4611 | assertCanCompile(expression);
|
4612 | 4612 |
|
|
0 commit comments