Examples of MockBodyContent


Examples of org.springframework.mock.web.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.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.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.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.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

Examples of org.springframework.mock.web.MockBodyContent

    String bodyContent = "some content";

    this.tag.setValue("foo");
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    this.tag.setBodyContent(new MockBodyContent(bodyContent, getWriter()));
    result = this.tag.doEndTag();
    assertEquals(Tag.EVAL_PAGE, result);

    String output = getOutput();
    assertOptionTagOpened(output);
View Full Code Here

Examples of org.springframework.mock.web.MockBodyContent

    String bodyContent = "some content";

    this.tag.setValue("Rob Harrop");
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    this.tag.setBodyContent(new MockBodyContent(bodyContent, getWriter()));
    result = this.tag.doEndTag();
    assertEquals(Tag.EVAL_PAGE, result);

    String output = getOutput();
    assertOptionTagOpened(output);
View Full Code Here

Examples of org.springframework.mock.web.MockBodyContent

    String bodyContent = "some content";

    this.tag.setValue(bodyContent);
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    this.tag.setBodyContent(new MockBodyContent(bodyContent, getWriter()));
    result = this.tag.doEndTag();
    assertEquals(Tag.EVAL_PAGE, result);

    String output = getOutput();
    assertOptionTagOpened(output);
View Full Code Here

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
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.