@@ -100,7 +100,7 @@ public void doubleArrayCoercion() {
100100 }
101101
102102 @ Test
103- public void SPR5899 () throws Exception {
103+ public void SPR5899 () {
104104 StandardEvaluationContext eContext = new StandardEvaluationContext (new Spr5899Class ());
105105 Expression expr = new SpelExpressionParser ().parseRaw ("tryToInvokeWithNull(12)" );
106106 assertEquals (12 , expr .getValue (eContext ));
@@ -196,7 +196,7 @@ public String toString() {
196196
197197
198198 @ Test
199- public void SPR5905_InnerTypeReferences () throws Exception {
199+ public void SPR5905_InnerTypeReferences () {
200200 StandardEvaluationContext eContext = new StandardEvaluationContext (new Spr5899Class ());
201201 Expression expr = new SpelExpressionParser ().parseRaw ("T(java.util.Map$Entry)" );
202202 assertEquals (Map .Entry .class , expr .getValue (eContext ));
@@ -228,7 +228,7 @@ public int run2() {
228228
229229
230230 @ Test
231- public void SPR5804 () throws Exception {
231+ public void SPR5804 () {
232232 Map <String , String > m = new HashMap <>();
233233 m .put ("foo" , "bar" );
234234 StandardEvaluationContext eContext = new StandardEvaluationContext (m ); // root is a map instance
@@ -238,7 +238,7 @@ public void SPR5804() throws Exception {
238238 }
239239
240240 @ Test
241- public void SPR5847 () throws Exception {
241+ public void SPR5847 () {
242242 StandardEvaluationContext eContext = new StandardEvaluationContext (new TestProperties ());
243243 String name = null ;
244244 Expression expr = null ;
@@ -319,7 +319,7 @@ public void write(EvaluationContext context, Object target, String name, Object
319319
320320
321321 @ Test
322- public void NPE_SPR5673 () throws Exception {
322+ public void NPE_SPR5673 () {
323323 ParserContext hashes = TemplateExpressionParsingTests .HASH_DELIMITED_PARSER_CONTEXT ;
324324 ParserContext dollars = TemplateExpressionParsingTests .DEFAULT_TEMPLATE_PARSER_CONTEXT ;
325325
@@ -558,6 +558,41 @@ public XX() {
558558 }
559559
560560
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+
561596 static class Goo {
562597
563598 public static Goo instance = new Goo ();
@@ -586,21 +621,21 @@ static class Holder {
586621
587622 // ---
588623
589- private void checkTemplateParsing (String expression , String expectedValue ) throws Exception {
624+ private void checkTemplateParsing (String expression , String expectedValue ) {
590625 checkTemplateParsing (expression , TemplateExpressionParsingTests .DEFAULT_TEMPLATE_PARSER_CONTEXT , expectedValue );
591626 }
592627
593- private void checkTemplateParsing (String expression , ParserContext context , String expectedValue ) throws Exception {
628+ private void checkTemplateParsing (String expression , ParserContext context , String expectedValue ) {
594629 SpelExpressionParser parser = new SpelExpressionParser ();
595630 Expression expr = parser .parseExpression (expression , context );
596631 assertEquals (expectedValue , expr .getValue (TestScenarioCreator .getTestEvaluationContext ()));
597632 }
598633
599- private void checkTemplateParsingError (String expression , String expectedMessage ) throws Exception {
634+ private void checkTemplateParsingError (String expression , String expectedMessage ) {
600635 checkTemplateParsingError (expression , TemplateExpressionParsingTests .DEFAULT_TEMPLATE_PARSER_CONTEXT , expectedMessage );
601636 }
602637
603- private void checkTemplateParsingError (String expression , ParserContext context , String expectedMessage ) throws Exception {
638+ private void checkTemplateParsingError (String expression , ParserContext context , String expectedMessage ) {
604639 SpelExpressionParser parser = new SpelExpressionParser ();
605640 try {
606641 parser .parseExpression (expression , context );
@@ -783,7 +818,7 @@ public void elvis_SPR7209_2() {
783818 }
784819
785820 @ Test
786- public void mapOfMap_SPR7244 () throws Exception {
821+ public void mapOfMap_SPR7244 () {
787822 Map <String , Object > map = new LinkedHashMap <>();
788823 map .put ("uri" , "http:" );
789824 Map <String , String > nameMap = new LinkedHashMap <>();
@@ -804,7 +839,7 @@ public void mapOfMap_SPR7244() throws Exception {
804839 }
805840
806841 @ Test
807- public void projectionTypeDescriptors_1 () throws Exception {
842+ public void projectionTypeDescriptors_1 () {
808843 StandardEvaluationContext ctx = new StandardEvaluationContext (new C ());
809844 SpelExpressionParser parser = new SpelExpressionParser ();
810845 String el1 = "ls.![#this.equals('abc')]" ;
@@ -817,7 +852,7 @@ public void projectionTypeDescriptors_1() throws Exception {
817852 }
818853
819854 @ Test
820- public void projectionTypeDescriptors_2 () throws Exception {
855+ public void projectionTypeDescriptors_2 () {
821856 StandardEvaluationContext ctx = new StandardEvaluationContext (new C ());
822857 SpelExpressionParser parser = new SpelExpressionParser ();
823858 String el1 = "as.![#this.equals('abc')]" ;
@@ -830,7 +865,7 @@ public void projectionTypeDescriptors_2() throws Exception {
830865 }
831866
832867 @ Test
833- public void projectionTypeDescriptors_3 () throws Exception {
868+ public void projectionTypeDescriptors_3 () {
834869 StandardEvaluationContext ctx = new StandardEvaluationContext (new C ());
835870 SpelExpressionParser parser = new SpelExpressionParser ();
836871 String el1 = "ms.![key.equals('abc')]" ;
@@ -842,42 +877,8 @@ public void projectionTypeDescriptors_3() throws Exception {
842877 assertEquals (null , evaluated .getElementTypeDescriptor ());
843878 }
844879
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-
879880 @ Test
880- public void greaterThanWithNulls_SPR7840 () throws Exception {
881+ public void greaterThanWithNulls_SPR7840 () {
881882 List <D > list = new ArrayList <>();
882883 list .add (new D ("aaa" ));
883884 list .add (new D ("bbb" ));
@@ -1101,7 +1102,7 @@ public void bar(int... array) {
11011102
11021103
11031104 @ Test
1104- public void reservedWords_8228 () throws Exception {
1105+ public void reservedWords_8228 () {
11051106 // "DIV","EQ","GE","GT","LE","LT","MOD","NE","NOT"
11061107 @ SuppressWarnings ("unused" )
11071108 class Reserver {
@@ -1151,7 +1152,7 @@ public Reserver getReserver() {
11511152 }
11521153
11531154 @ Test
1154- public void reservedWordProperties_9862 () throws Exception {
1155+ public void reservedWordProperties_9862 () {
11551156 StandardEvaluationContext ctx = new StandardEvaluationContext ();
11561157 SpelExpressionParser parser = new SpelExpressionParser ();
11571158 SpelExpression expression = parser .parseRaw ("T(org.springframework.expression.spel.testresources.le.div.mod.reserved.Reserver).CONST" );
@@ -1328,7 +1329,7 @@ public void array() {
13281329 }
13291330
13301331 @ Test
1331- public void SPR9486_floatFunctionResolver () throws Exception {
1332+ public void SPR9486_floatFunctionResolver () {
13321333 Number expectedResult = Math .abs (-10.2f );
13331334 ExpressionParser parser = new SpelExpressionParser ();
13341335 SPR9486_FunctionsClass testObject = new SPR9486_FunctionsClass ();
@@ -1663,7 +1664,21 @@ public void SPR10091_primitiveTestValue() {
16631664 }
16641665
16651666 @ 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 () {
16671682 doTestSpr10146 ("/foo" , "EL1070E: Problem parsing left operand" );
16681683 doTestSpr10146 ("*foo" , "EL1070E: Problem parsing left operand" );
16691684 doTestSpr10146 ("%foo" , "EL1070E: Problem parsing left operand" );
@@ -1682,7 +1697,7 @@ private void doTestSpr10146(String expression, String expectedMessage) {
16821697 }
16831698
16841699 @ Test
1685- public void SPR10125 () throws Exception {
1700+ public void SPR10125 () {
16861701 StandardEvaluationContext context = new StandardEvaluationContext ();
16871702 String fromInterface = parser .parseExpression ("T(" + StaticFinalImpl1 .class .getName () + ").VALUE" ).getValue (
16881703 context , String .class );
@@ -1693,23 +1708,23 @@ public void SPR10125() throws Exception {
16931708 }
16941709
16951710 @ Test
1696- public void SPR10210 () throws Exception {
1711+ public void SPR10210 () {
16971712 StandardEvaluationContext context = new StandardEvaluationContext ();
16981713 context .setVariable ("bridgeExample" , new org .springframework .expression .spel .spr10210 .D ());
16991714 Expression parseExpression = parser .parseExpression ("#bridgeExample.bridgeMethod()" );
17001715 parseExpression .getValue (context );
17011716 }
17021717
17031718 @ Test
1704- public void SPR10328 () throws Exception {
1719+ public void SPR10328 () {
17051720 thrown .expect (SpelParseException .class );
17061721 thrown .expectMessage ("EL1071E: A required selection expression has not been specified" );
17071722 Expression exp = parser .parseExpression ("$[]" );
17081723 exp .getValue (Arrays .asList ("foo" , "bar" , "baz" ));
17091724 }
17101725
17111726 @ Test
1712- public void SPR10452 () throws Exception {
1727+ public void SPR10452 () {
17131728 SpelParserConfiguration configuration = new SpelParserConfiguration (false , false );
17141729 ExpressionParser parser = new SpelExpressionParser (configuration );
17151730
@@ -1734,7 +1749,7 @@ public void SPR10452() throws Exception {
17341749 }
17351750
17361751 @ Test
1737- public void SPR9495 () throws Exception {
1752+ public void SPR9495 () {
17381753 SpelParserConfiguration configuration = new SpelParserConfiguration (false , false );
17391754 ExpressionParser parser = new SpelExpressionParser (configuration );
17401755
@@ -1779,7 +1794,7 @@ public TypedValue execute(EvaluationContext context, Object target, Object... ar
17791794 }
17801795
17811796 @ Test
1782- public void SPR10486 () throws Exception {
1797+ public void SPR10486 () {
17831798 SpelExpressionParser parser = new SpelExpressionParser ();
17841799 StandardEvaluationContext context = new StandardEvaluationContext ();
17851800 Spr10486 rootObject = new Spr10486 ();
@@ -1790,7 +1805,7 @@ public void SPR10486() throws Exception {
17901805 }
17911806
17921807 @ Test
1793- public void SPR11142 () throws Exception {
1808+ public void SPR11142 () {
17941809 SpelExpressionParser parser = new SpelExpressionParser ();
17951810 StandardEvaluationContext context = new StandardEvaluationContext ();
17961811 Spr11142 rootObject = new Spr11142 ();
@@ -1928,7 +1943,7 @@ public void SPR12808() {
19281943
19291944 @ Test
19301945 @ SuppressWarnings ("rawtypes" )
1931- public void SPR13055 () throws Exception {
1946+ public void SPR13055 () {
19321947 List <Map <String , Object >> myPayload = new ArrayList <>();
19331948
19341949 Map <String , Object > v1 = new HashMap <>();
0 commit comments