* Tests {@link MustacheRenderer#render(String, org.apache.tiles.request.Request)}.
* @throws IOException If something goes wrong.
*/
@Test
public void testRender() throws IOException {
Request request = createMock(Request.class);
Writer writer = createMock(Writer.class);
ApplicationContext applicationContext = createMock(ApplicationContext.class);
ApplicationResource applicationResource = createMock(ApplicationResource.class);
expect(applicationResource.getInputStream()).andReturn(getClass().getResource("/test.html").openStream());
Map<String,Object> context = Collections.singletonMap("testKey", (Object)"test value");
expect(request.getApplicationContext()).andReturn(applicationContext);
expect(applicationContext.getResource(isA(String.class))).andReturn(applicationResource).anyTimes();
expect(request.getAvailableScopes()).andReturn(Arrays.asList("request", "session", "application"));
expect(request.getContext("request")).andReturn(context);
expect(request.getContext("session")).andReturn(Collections.<String,Object>emptyMap());
expect(request.getContext("application")).andReturn(Collections.<String,Object>emptyMap());
expect(request.getWriter()).andReturn(writer);
writer.write("test template with test value");
writer.flush();
replay(request, applicationContext, applicationResource, writer);
Renderer renderer = new MustacheRenderer();