Java Code Examples for org.springframework.mock.web.test.MockHttpServletRequest#removeParameter()
The following examples show how to use
org.springframework.mock.web.test.MockHttpServletRequest#removeParameter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServletRequestDataBinderTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void testFieldDefaultPreemptsFieldMarker() throws Exception { TestBean target = new TestBean(); ServletRequestDataBinder binder = new ServletRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("!postProcessed", "on"); request.addParameter("_postProcessed", "visible"); request.addParameter("postProcessed", "on"); binder.bind(request); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(request); assertTrue(target.isPostProcessed()); request.removeParameter("!postProcessed"); binder.bind(request); assertFalse(target.isPostProcessed()); }
Example 2
Source File: WebRequestDataBinderTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void testWithCommaSeparatedStringArray() throws Exception { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("stringArray", "bar"); request.addParameter("stringArray", "abc"); request.addParameter("stringArray", "123,def"); binder.bind(new ServletWebRequest(request)); assertEquals("Expected all three items to be bound", 3, target.getStringArray().length); request.removeParameter("stringArray"); request.addParameter("stringArray", "123,def"); binder.bind(new ServletWebRequest(request)); assertEquals("Expected only 1 item to be bound", 1, target.getStringArray().length); }
Example 3
Source File: WebRequestDataBinderTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void testFieldDefaultPreemptsFieldMarker() throws Exception { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("!postProcessed", "on"); request.addParameter("_postProcessed", "visible"); request.addParameter("postProcessed", "on"); binder.bind(new ServletWebRequest(request)); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(new ServletWebRequest(request)); assertTrue(target.isPostProcessed()); request.removeParameter("!postProcessed"); binder.bind(new ServletWebRequest(request)); assertFalse(target.isPostProcessed()); }
Example 4
Source File: ServletRequestDataBinderTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void testWithCommaSeparatedStringArray() throws Exception { TestBean target = new TestBean(); ServletRequestDataBinder binder = new ServletRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("stringArray", "bar"); request.addParameter("stringArray", "abc"); request.addParameter("stringArray", "123,def"); binder.bind(request); assertEquals("Expected all three items to be bound", 3, target.getStringArray().length); request.removeParameter("stringArray"); request.addParameter("stringArray", "123,def"); binder.bind(request); assertEquals("Expected only 1 item to be bound", 1, target.getStringArray().length); }
Example 5
Source File: ServletRequestDataBinderTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void testWithCommaSeparatedStringArray() throws Exception { TestBean target = new TestBean(); ServletRequestDataBinder binder = new ServletRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("stringArray", "bar"); request.addParameter("stringArray", "abc"); request.addParameter("stringArray", "123,def"); binder.bind(request); assertEquals("Expected all three items to be bound", 3, target.getStringArray().length); request.removeParameter("stringArray"); request.addParameter("stringArray", "123,def"); binder.bind(request); assertEquals("Expected only 1 item to be bound", 1, target.getStringArray().length); }
Example 6
Source File: ServletRequestDataBinderTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void testFieldPrefixCausesFieldResetWithIgnoreUnknownFields() throws Exception { TestBean target = new TestBean(); ServletRequestDataBinder binder = new ServletRequestDataBinder(target); binder.setIgnoreUnknownFields(false); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("_postProcessed", "visible"); request.addParameter("postProcessed", "on"); binder.bind(request); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(request); assertFalse(target.isPostProcessed()); }
Example 7
Source File: ServletRequestDataBinderTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void testWithCommaSeparatedStringArray() throws Exception { TestBean target = new TestBean(); ServletRequestDataBinder binder = new ServletRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("stringArray", "bar"); request.addParameter("stringArray", "abc"); request.addParameter("stringArray", "123,def"); binder.bind(request); assertEquals("Expected all three items to be bound", 3, target.getStringArray().length); request.removeParameter("stringArray"); request.addParameter("stringArray", "123,def"); binder.bind(request); assertEquals("Expected only 1 item to be bound", 1, target.getStringArray().length); }
Example 8
Source File: WebRequestDataBinderTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void testFieldDefaultPreemptsFieldMarker() throws Exception { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("!postProcessed", "on"); request.addParameter("_postProcessed", "visible"); request.addParameter("postProcessed", "on"); binder.bind(new ServletWebRequest(request)); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(new ServletWebRequest(request)); assertTrue(target.isPostProcessed()); request.removeParameter("!postProcessed"); binder.bind(new ServletWebRequest(request)); assertFalse(target.isPostProcessed()); }
Example 9
Source File: ServletRequestDataBinderTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void testFieldPrefixCausesFieldResetWithIgnoreUnknownFields() throws Exception { TestBean target = new TestBean(); ServletRequestDataBinder binder = new ServletRequestDataBinder(target); binder.setIgnoreUnknownFields(false); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("_postProcessed", "visible"); request.addParameter("postProcessed", "on"); binder.bind(request); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(request); assertFalse(target.isPostProcessed()); }
Example 10
Source File: ServletRequestDataBinderTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testFieldDefault() throws Exception { TestBean target = new TestBean(); ServletRequestDataBinder binder = new ServletRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("!postProcessed", "off"); request.addParameter("postProcessed", "on"); binder.bind(request); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(request); assertFalse(target.isPostProcessed()); }
Example 11
Source File: ServletRequestDataBinderTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testFieldDefaultNonBoolean() throws Exception { TestBean target = new TestBean(); ServletRequestDataBinder binder = new ServletRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("!name", "anonymous"); request.addParameter("name", "Scott"); binder.bind(request); assertEquals("Scott", target.getName()); request.removeParameter("name"); binder.bind(request); assertEquals("anonymous", target.getName()); }
Example 12
Source File: ServletRequestDataBinderTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testFieldPrefixCausesFieldReset() throws Exception { TestBean target = new TestBean(); ServletRequestDataBinder binder = new ServletRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("_postProcessed", "visible"); request.addParameter("postProcessed", "on"); binder.bind(request); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(request); assertFalse(target.isPostProcessed()); }
Example 13
Source File: WebRequestDataBinderTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testFieldPrefixCausesFieldReset() throws Exception { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("_postProcessed", "visible"); request.addParameter("postProcessed", "on"); binder.bind(new ServletWebRequest(request)); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(new ServletWebRequest(request)); assertFalse(target.isPostProcessed()); }
Example 14
Source File: ServletRequestDataBinderTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testFieldDefaultNonBoolean() throws Exception { TestBean target = new TestBean(); ServletRequestDataBinder binder = new ServletRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("!name", "anonymous"); request.addParameter("name", "Scott"); binder.bind(request); assertEquals("Scott", target.getName()); request.removeParameter("name"); binder.bind(request); assertEquals("anonymous", target.getName()); }
Example 15
Source File: WebRequestDataBinderTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testFieldPrefixCausesFieldReset() throws Exception { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("_postProcessed", "visible"); request.addParameter("postProcessed", "on"); binder.bind(new ServletWebRequest(request)); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(new ServletWebRequest(request)); assertFalse(target.isPostProcessed()); }
Example 16
Source File: ServletRequestDataBinderTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testFieldDefaultNonBoolean() throws Exception { TestBean target = new TestBean(); ServletRequestDataBinder binder = new ServletRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("!name", "anonymous"); request.addParameter("name", "Scott"); binder.bind(request); assertEquals("Scott", target.getName()); request.removeParameter("name"); binder.bind(request); assertEquals("anonymous", target.getName()); }
Example 17
Source File: WebRequestDataBinderTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testFieldDefault() throws Exception { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("!postProcessed", "off"); request.addParameter("postProcessed", "on"); binder.bind(new ServletWebRequest(request)); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(new ServletWebRequest(request)); assertFalse(target.isPostProcessed()); }
Example 18
Source File: WebRequestDataBinderTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testFieldDefault() throws Exception { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("!postProcessed", "off"); request.addParameter("postProcessed", "on"); binder.bind(new ServletWebRequest(request)); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(new ServletWebRequest(request)); assertFalse(target.isPostProcessed()); }
Example 19
Source File: ServletRequestDataBinderTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testFieldDefault() throws Exception { TestBean target = new TestBean(); ServletRequestDataBinder binder = new ServletRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("!postProcessed", "off"); request.addParameter("postProcessed", "on"); binder.bind(request); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(request); assertFalse(target.isPostProcessed()); }
Example 20
Source File: WebRequestDataBinderTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testFieldPrefixCausesFieldReset() throws Exception { TestBean target = new TestBean(); WebRequestDataBinder binder = new WebRequestDataBinder(target); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("_postProcessed", "visible"); request.addParameter("postProcessed", "on"); binder.bind(new ServletWebRequest(request)); assertTrue(target.isPostProcessed()); request.removeParameter("postProcessed"); binder.bind(new ServletWebRequest(request)); assertFalse(target.isPostProcessed()); }