Commits

Anonymous committed 41f7419

Fixed unit test failing due some OGNL changes

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@1401e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (1)

src/test/com/opensymphony/xwork2/util/OgnlValueStackTest.java

         try {
             vs.setValue("count", "1", true);
             fail("Expected an exception for mismatched getter and setter");
-        } catch (RuntimeException e) {
+        } catch (XWorkException e) {
             //expected
         }
 
         try {
             vs.setValue("count2", "a", true);
             fail("Expected an exception for mismatched getter and setter");
-        } catch (RuntimeException e) {
+        } catch (XWorkException e) {
             //expected
         }
     }
 
         try {
             vs.setValue("count", "1");
-        } catch (RuntimeException e) {
-            fail("Unexpected exception for mismatched getter and setter");
+            fail("Expected an exception for mismatched getter and setter");
+        } catch (XWorkException e) {
+            //expected
         }
 
         try {
             vs.setValue("count2", "a");
-        } catch (RuntimeException e) {
-            fail("Unexpected exception for mismatched getter and setter");
+            fail("Expected an exception for mismatched getter and setter");
+        } catch (XWorkException e) {
+            //expected
         }
     }
 
         OgnlValueStack stack = new OgnlValueStack();
         stack.getContext().put(XWorkConverter.REPORT_CONVERSION_ERRORS, Boolean.TRUE);
         stack.push(action);
-        stack.setValue("bean", "foobar");
+        try {
+            stack.setValue("bean", "foobar");
+            fail("Should have thrown a type conversion exception");
+        } catch (XWorkException e) {
+            // expected
+        }
 
         Map conversionErrors = (Map) stack.getContext().get(ActionContext.CONVERSION_ERRORS);
         assertTrue(conversionErrors.containsKey("bean"));
         OgnlValueStack stack = new OgnlValueStack();
         stack.push(bean);
         stack.getContext().put(XWorkConverter.REPORT_CONVERSION_ERRORS, Boolean.TRUE);
-        stack.setValue("count", "a");
+        try {
+            stack.setValue("count", "a");
+            fail("Should have thrown a type conversion exception");
+        } catch (XWorkException e) {
+            // expected
+        }
 
         Map conversionErrors = (Map) stack.getContext().get(ActionContext.CONVERSION_ERRORS);
         assertTrue(conversionErrors.containsKey("count"));