Spring Framework MockPageContext - 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 MockPageContext class.

This code example shows how to use the following methods:getResponse
    public void testConverterTag() throws JspException, UnsupportedEncodingException { 
        String expected = "result"; 
        String source = "incomingLink"; 
        when(bbForeignLinksPostprocessor.postProcess(source)).thenReturn(expected); 
 
        tag.setPageContext(pageContext); 
        tag.setIncomingLink(source); 
 
        tag.doStartTag(); 
 
        String output = ((MockHttpServletResponse) pageContext.getResponse()).getContentAsString(); 
        assertEquals(output, expected); 
    } 
 
 
 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getResponse
    public void testConverterTag() throws JspException, UnsupportedEncodingException { 
        String expected = "result"; 
        String source = "source"; 
        when(bbCodeService.convertBbToHtml(source)).thenReturn(expected); 
 
        tag.setPageContext(pageContext); 
        tag.setBbCode(source); 
 
        tag.doStartTag(); 
 
        String output = ((MockHttpServletResponse) pageContext.getResponse()).getContentAsString(); 
        assertEquals(output, expected); 
    } 
 
 
 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	 */ 
	@Test 
	@Verifies(value = "print any domain object", method = "doStartTag()") 
	public void doStartTag_shouldPrintAnyDomainObject() throws Exception { 
		FormatTag tag = new FormatTag(); 
		PageContext pageContext = new MockPageContext(); 
		tag.setPageContext(pageContext); 
		tag.setVar(ATTRIBUTE_OBJECT_VALUE); 
		 
		// check if concept is properly printed 
		checkStartTagEvaluation(pageContext, tag, Context.getConceptService().getConcept(3), "COUGH SYRUP"); 
		 
		// check if encounter is properly printed 
		checkStartTagEvaluation(pageContext, tag, Context.getEncounterService().getEncounter(3), 
		    "Emergency @Unknown Location | 01/08/2008 | Super User"); 
		 
		// check if observation value is properly printed 
		checkStartTagEvaluation(pageContext, tag, Context.getObsService().getObs(7), "50.0"); 
		 
		// check if user is properly printed 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	@Before 
	public void setup() { 
		servletContext = new MockServletContext(); 
		request = new MockHttpServletRequest(); 
		response = new MockHttpServletResponse(); 
		pageContext = new MockPageContext(servletContext, request, response); 
	} 
 
	@Test 
	public void initWithExplicitApiKey() throws Exception { 
		FacebookInitTag tag = new FacebookInitTag(); 
		tag.setPageContext(pageContext); 
		tag.setAppId("test-id"); 
		assertEquals(TagSupport.SKIP_BODY, tag.doStartTag()); 
		assertEquals(TagSupport.EVAL_PAGE, tag.doEndTag()); 
		assertEquals( 
			"<script src='http://connect.facebook.net/en_US/all.js'></script><div id='fb-root'></div>" + 
			"<script type='text/javascript'>FB.init({appId: 'test-id', status: true, cookie: true, xfbml: true});</script>", 
			response.getContentAsString()); 
	} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRequest
	 
	@Before 
	public void setup() { 
		processor = getProcessor(); 
		MockServletContext mockServletContext = new MockServletContext(); 
		MockPageContext mockPageContext = new MockPageContext(mockServletContext); 
		request = (HttpServletRequest) mockPageContext.getRequest(); 
		confToBeApplied = new HashMap<ConfigToken<?>, Object>(); 
		tableConfiguration = new TableConfiguration(confToBeApplied, null, request); 
		tableConfiguration.setTableId("fakeId"); 
		columnConfiguration = new ColumnConfiguration(); 
	} 
	 
	@After 
	public void after(){ 
		ConfigurationStore.clear(); 
	} 
	 
	public abstract ConfigurationProcessor getProcessor(); 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRequest
	protected Map<ConfigToken<?>, Object> confToBeApplied; 
 
	@Before 
	public void setup() { 
		MockServletContext mockServletContext = new MockServletContext(); 
		MockPageContext mockPageContext = new MockPageContext(mockServletContext); 
		request = (HttpServletRequest) mockPageContext.getRequest(); 
		confToBeApplied = new HashMap<ConfigToken<?>, Object>(); 
		tableConfiguration = new TableConfiguration(confToBeApplied, null, request); 
		columnConfiguration = new ColumnConfiguration(); 
	} 
	 
	@Test 
	public void should_update_the_table_entry_with_true() throws Exception{ 
		Entry<ConfigToken<?>, Object> entry = new MapEntry<ConfigToken<?>, Object>(TableConfig.AJAX_DEFERRENDER, "true"); 
		ConfigurationProcessor processor = new BooleanProcessor(); 
		processor.process(entry, tableConfiguration); 
		assertThat(entry.getValue()).isEqualTo(true); 
	} 
	 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRequest
	protected Map<ConfigToken<?>, Object> confToBeApplied; 
 
	@Before 
	public void setup() { 
		MockServletContext mockServletContext = new MockServletContext(); 
		MockPageContext mockPageContext = new MockPageContext(mockServletContext); 
		request = (HttpServletRequest) mockPageContext.getRequest(); 
		confToBeApplied = new HashMap<ConfigToken<?>, Object>(); 
		tableConfiguration = new TableConfiguration(confToBeApplied, null, request); 
		columnConfiguration = new ColumnConfiguration(); 
	} 
	 
	@Test 
	public void should_update_the_table_entry_with_1() throws Exception{ 
		Entry<ConfigToken<?>, Object> entry = new MapEntry<ConfigToken<?>, Object>(TableConfig.AJAX_PIPESIZE, "1"); 
		ConfigurationProcessor processor = new IntegerProcessor(); 
		processor.process(entry, tableConfiguration); 
		assertThat(entry.getValue()).isEqualTo(1); 
	} 
	 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getRequest
	protected Map<ConfigToken<?>, Object> confToBeApplied; 
 
	@Before 
	public void setup() { 
		MockServletContext mockServletContext = new MockServletContext(); 
		MockPageContext mockPageContext = new MockPageContext(mockServletContext); 
		request = (HttpServletRequest) mockPageContext.getRequest(); 
		confToBeApplied = new HashMap<ConfigToken<?>, Object>(); 
		tableConfiguration = new TableConfiguration(confToBeApplied, null, request); 
		columnConfiguration = new ColumnConfiguration(); 
	} 
 
	@Test 
	public void should_update_the_table_entry() throws Exception{ 
		Entry<ConfigToken<?>, Object> entry = new MapEntry<ConfigToken<?>, Object>(TableConfig.CSS_CLASS, "someString"); 
		ConfigurationProcessor processor = new StringBuilderProcessor(); 
		processor.process(entry, tableConfiguration); 
		assertThat(entry.getValue().toString()).isEqualTo("someString"); 
	} 
	 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    private IfEnabledTag tag;
 
    @Before 
    public void setUp() { 
        this.tag = new IfEnabledTag();
        this.tag.setPageContext(new MockPageContext());
        this.tag.setLogger(this.logger);
    } 
 
    @Test
    public void testDoStartTagEnabledString() throws Exception {
        this.tag.setLevel("warn");
 
        assertEquals("The return value is not correct.", Tag.EVAL_BODY_INCLUDE, this.tag.doStartTag());
    } 
 
    @Test
    public void testDoStartTagEnabledLevel() throws Exception {
        this.tag.setLevel(Level.WARN);
 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    private CatchingTag tag;
 
    @Before 
    public void setUp() { 
        this.tag = new CatchingTag();
        this.tag.setPageContext(new MockPageContext());
        this.tag.setLogger(this.logger);
    } 
 
    @Test
    public void testDoEndTag() throws Exception {
        this.tag.setException(new Exception("This is a test."));
 
        assertEquals("The return value is not correct.", Tag.EVAL_PAGE, this.tag.doEndTag());
        verify("catching ERROR M-CATCHING[ EXCEPTION ] E java.lang.Exception: This is a test."); 
    } 
 
    @Test
    public void testDoEndTagLevelString() throws Exception {
        this.tag.setLevel("info");
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java