@@ -100,7 +100,7 @@ public void doubleArrayCoercion() {
100
100
}
101
101
102
102
@ Test
103
- public void SPR5899 () throws Exception {
103
+ public void SPR5899 () {
104
104
StandardEvaluationContext eContext = new StandardEvaluationContext (new Spr5899Class ());
105
105
Expression expr = new SpelExpressionParser ().parseRaw ("tryToInvokeWithNull(12)" );
106
106
assertEquals (12 , expr .getValue (eContext ));
@@ -196,7 +196,7 @@ public String toString() {
196
196
197
197
198
198
@ Test
199
- public void SPR5905_InnerTypeReferences () throws Exception {
199
+ public void SPR5905_InnerTypeReferences () {
200
200
StandardEvaluationContext eContext = new StandardEvaluationContext (new Spr5899Class ());
201
201
Expression expr = new SpelExpressionParser ().parseRaw ("T(java.util.Map$Entry)" );
202
202
assertEquals (Map .Entry .class , expr .getValue (eContext ));
@@ -228,7 +228,7 @@ public int run2() {
228
228
229
229
230
230
@ Test
231
- public void SPR5804 () throws Exception {
231
+ public void SPR5804 () {
232
232
Map <String , String > m = new HashMap <>();
233
233
m .put ("foo" , "bar" );
234
234
StandardEvaluationContext eContext = new StandardEvaluationContext (m ); // root is a map instance
@@ -238,7 +238,7 @@ public void SPR5804() throws Exception {
238
238
}
239
239
240
240
@ Test
241
- public void SPR5847 () throws Exception {
241
+ public void SPR5847 () {
242
242
StandardEvaluationContext eContext = new StandardEvaluationContext (new TestProperties ());
243
243
String name = null ;
244
244
Expression expr = null ;
@@ -319,7 +319,7 @@ public void write(EvaluationContext context, Object target, String name, Object
319
319
320
320
321
321
@ Test
322
- public void NPE_SPR5673 () throws Exception {
322
+ public void NPE_SPR5673 () {
323
323
ParserContext hashes = TemplateExpressionParsingTests .HASH_DELIMITED_PARSER_CONTEXT ;
324
324
ParserContext dollars = TemplateExpressionParsingTests .DEFAULT_TEMPLATE_PARSER_CONTEXT ;
325
325
@@ -558,6 +558,41 @@ public XX() {
558
558
}
559
559
560
560
561
+ static class C {
562
+
563
+ public List <String > ls ;
564
+
565
+ public String [] as ;
566
+
567
+ public Map <String , String > ms ;
568
+
569
+ C () {
570
+ ls = new ArrayList <>();
571
+ ls .add ("abc" );
572
+ ls .add ("def" );
573
+ as = new String [] { "abc" , "def" };
574
+ ms = new HashMap <>();
575
+ ms .put ("abc" , "xyz" );
576
+ ms .put ("def" , "pqr" );
577
+ }
578
+ }
579
+
580
+
581
+ static class D {
582
+
583
+ public String a ;
584
+
585
+ private D (String s ) {
586
+ a = s ;
587
+ }
588
+
589
+ @ Override
590
+ public String toString () {
591
+ return "D(" + a + ")" ;
592
+ }
593
+ }
594
+
595
+
561
596
static class Goo {
562
597
563
598
public static Goo instance = new Goo ();
@@ -586,21 +621,21 @@ static class Holder {
586
621
587
622
// ---
588
623
589
- private void checkTemplateParsing (String expression , String expectedValue ) throws Exception {
624
+ private void checkTemplateParsing (String expression , String expectedValue ) {
590
625
checkTemplateParsing (expression , TemplateExpressionParsingTests .DEFAULT_TEMPLATE_PARSER_CONTEXT , expectedValue );
591
626
}
592
627
593
- private void checkTemplateParsing (String expression , ParserContext context , String expectedValue ) throws Exception {
628
+ private void checkTemplateParsing (String expression , ParserContext context , String expectedValue ) {
594
629
SpelExpressionParser parser = new SpelExpressionParser ();
595
630
Expression expr = parser .parseExpression (expression , context );
596
631
assertEquals (expectedValue , expr .getValue (TestScenarioCreator .getTestEvaluationContext ()));
597
632
}
598
633
599
- private void checkTemplateParsingError (String expression , String expectedMessage ) throws Exception {
634
+ private void checkTemplateParsingError (String expression , String expectedMessage ) {
600
635
checkTemplateParsingError (expression , TemplateExpressionParsingTests .DEFAULT_TEMPLATE_PARSER_CONTEXT , expectedMessage );
601
636
}
602
637
603
- private void checkTemplateParsingError (String expression , ParserContext context , String expectedMessage ) throws Exception {
638
+ private void checkTemplateParsingError (String expression , ParserContext context , String expectedMessage ) {
604
639
SpelExpressionParser parser = new SpelExpressionParser ();
605
640
try {
606
641
parser .parseExpression (expression , context );
@@ -783,7 +818,7 @@ public void elvis_SPR7209_2() {
783
818
}
784
819
785
820
@ Test
786
- public void mapOfMap_SPR7244 () throws Exception {
821
+ public void mapOfMap_SPR7244 () {
787
822
Map <String , Object > map = new LinkedHashMap <>();
788
823
map .put ("uri" , "http:" );
789
824
Map <String , String > nameMap = new LinkedHashMap <>();
@@ -804,7 +839,7 @@ public void mapOfMap_SPR7244() throws Exception {
804
839
}
805
840
806
841
@ Test
807
- public void projectionTypeDescriptors_1 () throws Exception {
842
+ public void projectionTypeDescriptors_1 () {
808
843
StandardEvaluationContext ctx = new StandardEvaluationContext (new C ());
809
844
SpelExpressionParser parser = new SpelExpressionParser ();
810
845
String el1 = "ls.![#this.equals('abc')]" ;
@@ -817,7 +852,7 @@ public void projectionTypeDescriptors_1() throws Exception {
817
852
}
818
853
819
854
@ Test
820
- public void projectionTypeDescriptors_2 () throws Exception {
855
+ public void projectionTypeDescriptors_2 () {
821
856
StandardEvaluationContext ctx = new StandardEvaluationContext (new C ());
822
857
SpelExpressionParser parser = new SpelExpressionParser ();
823
858
String el1 = "as.![#this.equals('abc')]" ;
@@ -830,7 +865,7 @@ public void projectionTypeDescriptors_2() throws Exception {
830
865
}
831
866
832
867
@ Test
833
- public void projectionTypeDescriptors_3 () throws Exception {
868
+ public void projectionTypeDescriptors_3 () {
834
869
StandardEvaluationContext ctx = new StandardEvaluationContext (new C ());
835
870
SpelExpressionParser parser = new SpelExpressionParser ();
836
871
String el1 = "ms.![key.equals('abc')]" ;
@@ -842,42 +877,8 @@ public void projectionTypeDescriptors_3() throws Exception {
842
877
assertEquals (null , evaluated .getElementTypeDescriptor ());
843
878
}
844
879
845
-
846
- static class C {
847
-
848
- public List <String > ls ;
849
- public String [] as ;
850
- public Map <String , String > ms ;
851
-
852
- C () {
853
- ls = new ArrayList <>();
854
- ls .add ("abc" );
855
- ls .add ("def" );
856
- as = new String [] { "abc" , "def" };
857
- ms = new HashMap <>();
858
- ms .put ("abc" , "xyz" );
859
- ms .put ("def" , "pqr" );
860
- }
861
- }
862
-
863
-
864
- static class D {
865
-
866
- public String a ;
867
-
868
- private D (String s ) {
869
- a = s ;
870
- }
871
-
872
- @ Override
873
- public String toString () {
874
- return "D(" + a + ")" ;
875
- }
876
- }
877
-
878
-
879
880
@ Test
880
- public void greaterThanWithNulls_SPR7840 () throws Exception {
881
+ public void greaterThanWithNulls_SPR7840 () {
881
882
List <D > list = new ArrayList <>();
882
883
list .add (new D ("aaa" ));
883
884
list .add (new D ("bbb" ));
@@ -1101,7 +1102,7 @@ public void bar(int... array) {
1101
1102
1102
1103
1103
1104
@ Test
1104
- public void reservedWords_8228 () throws Exception {
1105
+ public void reservedWords_8228 () {
1105
1106
// "DIV","EQ","GE","GT","LE","LT","MOD","NE","NOT"
1106
1107
@ SuppressWarnings ("unused" )
1107
1108
class Reserver {
@@ -1151,7 +1152,7 @@ public Reserver getReserver() {
1151
1152
}
1152
1153
1153
1154
@ Test
1154
- public void reservedWordProperties_9862 () throws Exception {
1155
+ public void reservedWordProperties_9862 () {
1155
1156
StandardEvaluationContext ctx = new StandardEvaluationContext ();
1156
1157
SpelExpressionParser parser = new SpelExpressionParser ();
1157
1158
SpelExpression expression = parser .parseRaw ("T(org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver).CONST" );
@@ -1328,7 +1329,7 @@ public void array() {
1328
1329
}
1329
1330
1330
1331
@ Test
1331
- public void SPR9486_floatFunctionResolver () throws Exception {
1332
+ public void SPR9486_floatFunctionResolver () {
1332
1333
Number expectedResult = Math .abs (-10.2f );
1333
1334
ExpressionParser parser = new SpelExpressionParser ();
1334
1335
SPR9486_FunctionsClass testObject = new SPR9486_FunctionsClass ();
@@ -1663,7 +1664,21 @@ public void SPR10091_primitiveTestValue() {
1663
1664
}
1664
1665
1665
1666
@ Test
1666
- public void SPR10146_malformedExpressions () throws Exception {
1667
+ public void SPR16123 () {
1668
+ ExpressionParser parser = new SpelExpressionParser ();
1669
+ parser .parseExpression ("simpleProperty" ).setValue (new BooleanHolder (), null );
1670
+
1671
+ try {
1672
+ parser .parseExpression ("primitiveProperty" ).setValue (new BooleanHolder (), null );
1673
+ fail ("Should have thrown EvaluationException" );
1674
+ }
1675
+ catch (EvaluationException ex ) {
1676
+ // expected
1677
+ }
1678
+ }
1679
+
1680
+ @ Test
1681
+ public void SPR10146_malformedExpressions () {
1667
1682
doTestSpr10146 ("/foo" , "EL1070E: Problem parsing left operand" );
1668
1683
doTestSpr10146 ("*foo" , "EL1070E: Problem parsing left operand" );
1669
1684
doTestSpr10146 ("%foo" , "EL1070E: Problem parsing left operand" );
@@ -1682,7 +1697,7 @@ private void doTestSpr10146(String expression, String expectedMessage) {
1682
1697
}
1683
1698
1684
1699
@ Test
1685
- public void SPR10125 () throws Exception {
1700
+ public void SPR10125 () {
1686
1701
StandardEvaluationContext context = new StandardEvaluationContext ();
1687
1702
String fromInterface = parser .parseExpression ("T(" + StaticFinalImpl1 .class .getName () + ").VALUE" ).getValue (
1688
1703
context , String .class );
@@ -1693,23 +1708,23 @@ public void SPR10125() throws Exception {
1693
1708
}
1694
1709
1695
1710
@ Test
1696
- public void SPR10210 () throws Exception {
1711
+ public void SPR10210 () {
1697
1712
StandardEvaluationContext context = new StandardEvaluationContext ();
1698
1713
context .setVariable ("bridgeExample" , new org .springframework .expression .spel .spr10210 .D ());
1699
1714
Expression parseExpression = parser .parseExpression ("#bridgeExample.bridgeMethod()" );
1700
1715
parseExpression .getValue (context );
1701
1716
}
1702
1717
1703
1718
@ Test
1704
- public void SPR10328 () throws Exception {
1719
+ public void SPR10328 () {
1705
1720
thrown .expect (SpelParseException .class );
1706
1721
thrown .expectMessage ("EL1071E: A required selection expression has not been specified" );
1707
1722
Expression exp = parser .parseExpression ("$[]" );
1708
1723
exp .getValue (Arrays .asList ("foo" , "bar" , "baz" ));
1709
1724
}
1710
1725
1711
1726
@ Test
1712
- public void SPR10452 () throws Exception {
1727
+ public void SPR10452 () {
1713
1728
SpelParserConfiguration configuration = new SpelParserConfiguration (false , false );
1714
1729
ExpressionParser parser = new SpelExpressionParser (configuration );
1715
1730
@@ -1734,7 +1749,7 @@ public void SPR10452() throws Exception {
1734
1749
}
1735
1750
1736
1751
@ Test
1737
- public void SPR9495 () throws Exception {
1752
+ public void SPR9495 () {
1738
1753
SpelParserConfiguration configuration = new SpelParserConfiguration (false , false );
1739
1754
ExpressionParser parser = new SpelExpressionParser (configuration );
1740
1755
@@ -1779,7 +1794,7 @@ public TypedValue execute(EvaluationContext context, Object target, Object... ar
1779
1794
}
1780
1795
1781
1796
@ Test
1782
- public void SPR10486 () throws Exception {
1797
+ public void SPR10486 () {
1783
1798
SpelExpressionParser parser = new SpelExpressionParser ();
1784
1799
StandardEvaluationContext context = new StandardEvaluationContext ();
1785
1800
Spr10486 rootObject = new Spr10486 ();
@@ -1790,7 +1805,7 @@ public void SPR10486() throws Exception {
1790
1805
}
1791
1806
1792
1807
@ Test
1793
- public void SPR11142 () throws Exception {
1808
+ public void SPR11142 () {
1794
1809
SpelExpressionParser parser = new SpelExpressionParser ();
1795
1810
StandardEvaluationContext context = new StandardEvaluationContext ();
1796
1811
Spr11142 rootObject = new Spr11142 ();
@@ -1928,7 +1943,7 @@ public void SPR12808() {
1928
1943
1929
1944
@ Test
1930
1945
@ SuppressWarnings ("rawtypes" )
1931
- public void SPR13055 () throws Exception {
1946
+ public void SPR13055 () {
1932
1947
List <Map <String , Object >> myPayload = new ArrayList <>();
1933
1948
1934
1949
Map <String , Object > v1 = new HashMap <>();
0 commit comments