Examples of MockBodyContent


Examples of org.springframework.mock.web.MockBodyContent

    @Test
    public void testMessageBody() throws Exception {
        this.setUp(null);

        final MockBodyContent content = new MockBodyContent("This is the body content 01.", (Writer)null);
        this.tag.setBodyContent(content);

        assertEquals("The message is not correct.", "This is the body content 01.", this.tag.getMessage());
    }
View Full Code Here

Examples of org.springframework.mock.web.MockBodyContent

    @Test
    public void testMessageStringBodyIgnored() throws Exception {
        this.setUp(null);

        final MockBodyContent content = new MockBodyContent("This is more body content 02.", (Writer)null);
        this.tag.setBodyContent(content);
        this.tag.setMessage("This is another message 02.");

        assertEquals("The message is not correct.", "This is another message 02.", this.tag.getMessage());
    }
View Full Code Here

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

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

    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

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

  }


  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

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

    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

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

    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

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

    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

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

    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

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

    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
TOP
Copyright © 2018 www.massapi.com. 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.