Package org.springframework.mock.web.test

Examples of org.springframework.mock.web.test.MockBodyContent


    assertEquals(Tag.EVAL_PAGE, action);
    assertNull(parent.getArgument());
  }

  public void testArgumentWithBodyValue() throws JspException {
    tag.setBodyContent(new MockBodyContent("value2",
        new MockHttpServletResponse()));

    int action = tag.doEndTag();

    assertEquals(Tag.EVAL_PAGE, action);
View Full Code Here


    tag.release();

    parent = new MockArgumentSupportTag();
    tag.setPageContext(createPageContext());
    tag.setParent(parent);
    tag.setBodyContent(new MockBodyContent("value4",
        new MockHttpServletResponse()));

    action = tag.doEndTag();

    assertEquals(Tag.EVAL_PAGE, action);
View Full Code Here

  }


  public void testWithExplicitNonWhitespaceBodyContent() throws Exception {
    String mockContent = "This is some explicit body content";
    this.tag.setBodyContent(new MockBodyContent(mockContent, getWriter()));

    // construct an errors instance of the tag
    TestBean target = new TestBean();
    target.setName("Rob Harrop");
    Errors errors = new BeanPropertyBindingResult(target, COMMAND_NAME);
View Full Code Here

    assertEquals(Tag.EVAL_PAGE, result);
    assertEquals(mockContent, getOutput());
  }

  public void testWithExplicitWhitespaceBodyContent() throws Exception {
    this.tag.setBodyContent(new MockBodyContent("\t\n   ", getWriter()));

    // construct an errors instance of the tag
    TestBean target = new TestBean();
    target.setName("Rob Harrop");
    Errors errors = new BeanPropertyBindingResult(target, COMMAND_NAME);
View Full Code Here

    assertContainsAttribute(output, "id", "name.errors");
    assertBlockTagContains(output, "Default Message");
  }

  public void testWithExplicitEmptyWhitespaceBodyContent() throws Exception {
    this.tag.setBodyContent(new MockBodyContent("", getWriter()));

    // construct an errors instance of the tag
    TestBean target = new TestBean();
    target.setName("Rob Harrop");
    Errors errors = new BeanPropertyBindingResult(target, COMMAND_NAME);
View Full Code Here

    exposeBindingResult(errors);
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
    String bodyContent = "Foo";
    this.tag.setBodyContent(new MockBodyContent(bodyContent, getWriter()));
    this.tag.doEndTag();
    this.tag.doFinally();
    assertEquals(bodyContent, getOutput());
    assertNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
  }
View Full Code Here

    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
    assertTrue(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE) instanceof List);
    String bodyContent = "Foo";
    this.tag.setBodyContent(new MockBodyContent(bodyContent, getWriter()));
    this.tag.doEndTag();
    this.tag.doFinally();
    assertEquals(bodyContent, getOutput());
    assertEquals(existingAttribute, getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
  }
View Full Code Here

    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
    assertTrue(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE) instanceof List);
    String bodyContent = "Foo";
    this.tag.setBodyContent(new MockBodyContent(bodyContent, getWriter()));
    this.tag.doEndTag();
    this.tag.doFinally();
    assertEquals(bodyContent, getOutput());
    assertEquals(existingAttribute,
        getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE, PageContext.APPLICATION_SCOPE));
View Full Code Here

    assertEquals("value", parent.getParam().getValue());
  }

  public void testParamWithBodyValue() throws JspException {
    tag.setName("name");
    tag.setBodyContent(new MockBodyContent("value",
        new MockHttpServletResponse()));

    int action = tag.doEndTag();

    assertEquals(Tag.EVAL_PAGE, action);
View Full Code Here

    parent = new MockParamSupportTag();
    tag.setPageContext(createPageContext());
    tag.setParent(parent);
    tag.setName("name2");
    tag.setBodyContent(new MockBodyContent("value2",
        new MockHttpServletResponse()));

    action = tag.doEndTag();

    assertEquals(Tag.EVAL_PAGE, action);
View Full Code Here

TOP

Related Classes of org.springframework.mock.web.test.MockBodyContent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.