Spring Framework MockBodyContent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework MockBodyContent class.

This code example shows how to use the following methods:
	 */ 
	@Test 
	@Verifies(value = "use body content as fallback if no message resolved", method = "doEndTag()") 
	public void doEndTag_shouldUseBodyContentAsFallbackIfNoMessageResolved() throws Exception { 
		String expectedOutput = "test body content"; 
		openmrsMessageTag.setBodyContent(new MockBodyContent(expectedOutput, new MockHttpServletResponse())); 
		openmrsMessageTag.setCode("test.wrong.code"); 
		 
		checkDoEndTagEvaluation(expectedOutput); 
	} 
	 
	/** 
	 * @see {@link OpenmrsMessageTag#doEndTag()} 
	 */ 
	@Test 
	@Verifies(value = "use text attribute as fallback if no message resolved", method = "doEndTag()") 
	public void doEndTag_shouldUseTextAttributeAsFallbackIfNoMessageResolved() throws Exception { 
		String expectedOutput = "test content"; 
		openmrsMessageTag.setText(expectedOutput); 
		openmrsMessageTag.setCode("test.wrong.code"); 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
		StringBuilder body = new StringBuilder(); 
		body.append("<a href=\"http://myDomain.com\">Link</a>"); 
		body.append("\n"); 
		body.append("<div>Content</div>"); 
		 
		extraHtmlTag.setBodyContent(new MockBodyContent(body.toString(), mockPageContext.getOut())); 
		extraHtmlTag.setUid("M"); 
		extraHtmlTag.setCssClass("class1"); 
		extraHtmlTag.setCssStyle("float:left"); 
		extraHtmlTag.setContainer("div"); 
	} 
	 
	@Test 
	public void should_add_an_extraHtml_with_processed_content() throws JspException, UnsupportedEncodingException { 
		 
		ExtraHtml extraHtml = new ExtraHtml(); 
		extraHtml.setContent("<a href=\"http://myDomain.com\">Link</a><div>Content</div>"); 
		extraHtml.setUid("M"); 
		extraHtml.setCssClass("class1"); 
		extraHtml.setCssStyle("float:left"); 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
		StringBuilder body = new StringBuilder(); 
		body.append("<a href=\"http://myDomain.com\">Link</a>"); 
		body.append("\n"); 
		body.append("<div>Content</div>"); 
		 
		extraHtmlTag.setBodyContent(new MockBodyContent(body.toString(), mockPageContext.getOut())); 
		extraHtmlTag.setUid("M"); 
		extraHtmlTag.setCssClass("class1"); 
		extraHtmlTag.setCssStyle("float:left"); 
	} 
	 
	@Test 
	public void should_add_an_extraHtml_with_default_container() throws JspException, UnsupportedEncodingException { 
		 
		ExtraHtml extraHtml = new ExtraHtml(); 
		extraHtml.setContainer("div"); 
		extraHtml.setContent("<a href=\"http://myDomain.com\">Link</a><div>Content</div>"); 
		extraHtml.setUid("M"); 
		extraHtml.setCssClass("class1"); 
		extraHtml.setCssStyle("float:left"); 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java