List<ViewResolver> resolvers = compositeResolver.getViewResolvers();
assertEquals(BeanNameViewResolver.class, resolvers.get(0).getClass());
ViewResolver resolver = resolvers.get(1);
assertEquals(InternalResourceViewResolver.class, resolver.getClass());
DirectFieldAccessor accessor = new DirectFieldAccessor(resolver);
assertEquals(InternalResourceView.class, accessor.getPropertyValue("viewClass"));
assertEquals(TilesViewResolver.class, resolvers.get(2).getClass());
resolver = resolvers.get(3);
FreeMarkerViewResolver freeMarkerViewResolver = (FreeMarkerViewResolver) resolver;
accessor = new DirectFieldAccessor(resolver);
assertEquals("freemarker-", accessor.getPropertyValue("prefix"));
assertEquals(".freemarker", accessor.getPropertyValue("suffix"));
assertArrayEquals(new String[] {"my*", "*Report"}, (String[]) accessor.getPropertyValue("viewNames"));
assertEquals(1024, accessor.getPropertyValue("cacheLimit"));
resolver = resolvers.get(4);
VelocityViewResolver velocityViewResolver = (VelocityViewResolver) resolver;
accessor = new DirectFieldAccessor(resolver);
assertEquals("", accessor.getPropertyValue("prefix"));
assertEquals(".vm", accessor.getPropertyValue("suffix"));
assertEquals(0, accessor.getPropertyValue("cacheLimit"));
resolver = resolvers.get(5);
GroovyMarkupViewResolver groovyMarkupViewResolver = (GroovyMarkupViewResolver) resolver;
accessor = new DirectFieldAccessor(resolver);
assertEquals("", accessor.getPropertyValue("prefix"));
assertEquals(".tpl", accessor.getPropertyValue("suffix"));
assertEquals(1024, accessor.getPropertyValue("cacheLimit"));
assertEquals(InternalResourceViewResolver.class, resolvers.get(6).getClass());
assertEquals(InternalResourceViewResolver.class, resolvers.get(7).getClass());
TilesConfigurer tilesConfigurer = appContext.getBean(TilesConfigurer.class);
assertNotNull(tilesConfigurer);
String[] definitions = {
"/org/springframework/web/servlet/resource/tiles/tiles1.xml",
"/org/springframework/web/servlet/resource/tiles/tiles2.xml"
};
accessor = new DirectFieldAccessor(tilesConfigurer);
assertArrayEquals(definitions, (String[]) accessor.getPropertyValue("definitions"));
assertTrue((boolean)accessor.getPropertyValue("checkRefresh"));
FreeMarkerConfigurer freeMarkerConfigurer = appContext.getBean(FreeMarkerConfigurer.class);
assertNotNull(freeMarkerConfigurer);
accessor = new DirectFieldAccessor(freeMarkerConfigurer);
assertArrayEquals(new String[]{"/", "/test"}, (String[]) accessor.getPropertyValue("templateLoaderPaths"));
VelocityConfigurer velocityConfigurer = appContext.getBean(VelocityConfigurer.class);
assertNotNull(velocityConfigurer);
accessor = new DirectFieldAccessor(velocityConfigurer);
assertEquals("/test", accessor.getPropertyValue("resourceLoaderPath"));
GroovyMarkupConfigurer groovyMarkupConfigurer = appContext.getBean(GroovyMarkupConfigurer.class);
assertNotNull(groovyMarkupConfigurer);
assertEquals("/test", groovyMarkupConfigurer.getResourceLoaderPath());
assertTrue(groovyMarkupConfigurer.isAutoIndent());