01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.webwork.views.freemarker;
06:
07: import com.mockobjects.servlet.MockServletContext;
08: import com.opensymphony.webwork.WebWorkConstants;
09: import com.opensymphony.webwork.config.Configuration;
10: import com.opensymphony.webwork.views.jsp.WebWorkMockServletContext;
11:
12: import junit.framework.TestCase;
13:
14: /**
15: * Test case for FreemarkerManager
16: *
17: * @author tm_jee
18: * @version $Date: 2006-02-16 15:13:05 +0100 (Thu, 16 Feb 2006) $ $Id: FreemarkerManagerTest.java 2190 2006-02-16 14:13:05Z tmjee $
19: */
20: public class FreemarkerManagerTest extends TestCase {
21:
22: public void testIfWebworkEncodingIsSetProperty() throws Exception {
23: Configuration.set(WebWorkConstants.WEBWORK_I18N_ENCODING,
24: "UTF-8");
25: WebWorkMockServletContext servletContext = new WebWorkMockServletContext();
26: servletContext.setAttribute(
27: FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY, null);
28: freemarker.template.Configuration conf = FreemarkerManager
29: .getInstance().getConfiguration(servletContext);
30: assertEquals(conf.getDefaultEncoding(), "UTF-8");
31: }
32: }
|