You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ja...@apache.org on 2010/03/23 00:13:46 UTC

svn commit: r926393 - /myfaces/core/trunk/api/src/test/java/javax/faces/component/UIViewParameterTest.java

Author: jakobk
Date: Mon Mar 22 23:13:46 2010
New Revision: 926393

URL: http://svn.apache.org/viewvc?rev=926393&view=rev
Log:
MYFACES-2592 UIViewParameter.decode() should set the submitted value only if it is not null (added test case)

Modified:
    myfaces/core/trunk/api/src/test/java/javax/faces/component/UIViewParameterTest.java

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/UIViewParameterTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/UIViewParameterTest.java?rev=926393&r1=926392&r2=926393&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/UIViewParameterTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/UIViewParameterTest.java Mon Mar 22 23:13:46 2010
@@ -69,5 +69,22 @@ public class UIViewParameterTest extends
         viewParameter.processValidators(facesContext);
         assertTrue(facesContext.isValidationFailed());
     }
+    
+    /**
+     * Tests if UIViewParameter.decode() sets the submitted value only if it is not null.
+     */
+    @SuppressWarnings("unchecked")
+    public void testDecodeSetOnlyNonNullSubmittedValue()
+    {
+        final String notNull = "not null";
+        viewParameter.setSubmittedValue(notNull);
+        
+        // explicitly set the value in the request parameter map to null
+        externalContext.getRequestParameterMap().put(viewParameter.getName(), null);
+        
+        viewParameter.decode(facesContext);
+        
+        assertEquals(viewParameter.getSubmittedValue(), notNull);
+    }
 
 }