Search in sources :

Example 6 with MockPageContext

use of org.springframework.mock.web.MockPageContext in project logging-log4j2 by apache.

the class DumpTagTest method setUp.

@Before
public void setUp() {
    this.output = new ByteArrayOutputStream();
    this.writer = new OutputStreamWriter(this.output, UTF8);
    this.context = new MockPageContext() {

        private final MockJspWriter jspWriter = new MockJspWriter(writer);

        @Override
        public JspWriter getOut() {
            return this.jspWriter;
        }
    };
    this.tag = new DumpTag();
    this.tag.setPageContext(this.context);
}
Also used : MockPageContext(org.springframework.mock.web.MockPageContext) MockJspWriter(org.springframework.mock.web.MockJspWriter) OutputStreamWriter(java.io.OutputStreamWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) JspWriter(javax.servlet.jsp.JspWriter) MockJspWriter(org.springframework.mock.web.MockJspWriter) Before(org.junit.Before)

Example 7 with MockPageContext

use of org.springframework.mock.web.MockPageContext in project logging-log4j2 by apache.

the class ExitTagTest method setUp.

@Before
public void setUp() {
    this.tag = new ExitTag();
    this.tag.setPageContext(new MockPageContext());
    this.tag.setLogger(this.logger);
}
Also used : MockPageContext(org.springframework.mock.web.MockPageContext) Before(org.junit.Before)

Example 8 with MockPageContext

use of org.springframework.mock.web.MockPageContext in project logging-log4j2 by apache.

the class IfEnabledTagTest method setUp.

@Before
public void setUp() {
    this.tag = new IfEnabledTag();
    this.tag.setPageContext(new MockPageContext());
    this.tag.setLogger(this.logger);
}
Also used : MockPageContext(org.springframework.mock.web.MockPageContext) Before(org.junit.Before)

Example 9 with MockPageContext

use of org.springframework.mock.web.MockPageContext in project logging-log4j2 by apache.

the class LoggingMessageTagSupportTest method setUp.

private void setUp(final Level level) {
    this.tag = new LoggingMessageTagSupport() {

        private static final long serialVersionUID = 1L;

        @Override
        protected Level getLevel() {
            return level;
        }
    };
    this.tag.setPageContext(new MockPageContext());
    this.tag.setLogger(this.logger);
}
Also used : MockPageContext(org.springframework.mock.web.MockPageContext) Level(org.apache.logging.log4j.Level)

Example 10 with MockPageContext

use of org.springframework.mock.web.MockPageContext in project logging-log4j2 by apache.

the class EnterTagTest method setUp.

@Before
public void setUp() {
    this.tag = new EntryTag();
    this.tag.setPageContext(new MockPageContext());
    this.tag.setLogger(this.logger);
}
Also used : MockPageContext(org.springframework.mock.web.MockPageContext) Before(org.junit.Before)

Aggregations

MockPageContext (org.springframework.mock.web.MockPageContext)11 Before (org.junit.Before)8 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)3 MockServletContext (org.springframework.mock.web.MockServletContext)3 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 JspWriter (javax.servlet.jsp.JspWriter)1 Level (org.apache.logging.log4j.Level)1 BeanDefinitionBuilder (org.springframework.beans.factory.support.BeanDefinitionBuilder)1 MockJspWriter (org.springframework.mock.web.MockJspWriter)1 PermissionEvaluator (org.springframework.security.access.PermissionEvaluator)1 WebApplicationContext (org.springframework.web.context.WebApplicationContext)1 StaticWebApplicationContext (org.springframework.web.context.support.StaticWebApplicationContext)1