List of usage examples for org.springframework.web.servlet.view.freemarker FreeMarkerView afterPropertiesSet
@Override public void afterPropertiesSet() throws Exception
From source file:org.hdiv.web.servlet.view.freemarker.FreeMarkerViewTests.java
@Test public void testNoTemplateName() throws Exception { FreeMarkerView fv = new FreeMarkerView(); try {/* w w w.j ava 2 s.co m*/ fv.afterPropertiesSet(); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException ex) { // Check there's a helpful error message assertTrue(ex.getMessage().indexOf("url") != -1); } }
From source file:org.hdiv.web.servlet.view.freemarker.FreeMarkerViewTests.java
@Test public void testNoFreeMarkerConfig() throws Exception { FreeMarkerView fv = new FreeMarkerView(); MockControl wmc = MockControl.createControl(WebApplicationContext.class); WebApplicationContext wac = (WebApplicationContext) wmc.getMock(); wac.getBeansOfType(FreeMarkerConfig.class, true, false); wmc.setReturnValue(new HashMap()); wac.getParentBeanFactory();// w w w. j a v a 2 s . com wmc.setReturnValue(null); wac.getServletContext(); wmc.setReturnValue(new MockServletContext()); wmc.replay(); fv.setUrl("anythingButNull"); try { fv.setApplicationContext(wac); fv.afterPropertiesSet(); fail("Should have thrown BeanDefinitionStoreException"); } catch (ApplicationContextException ex) { // Check there's a helpful error message assertTrue(ex.getMessage().indexOf("FreeMarkerConfig") != -1); } wmc.verify(); }