### Question:
DefaultController extends Results implements Status, HeaderNames, Controller { public Renderable<?> render(Template template, Map<String, Object> parameters) { return template.render(this, parameters); }  Logger logger(); Context context(); Request request(); SessionCookie session(); void session(String key, String value); String session(String key); FlashCookie flash(); void flash(String key, String value); String flash(String key); List<Route> routes(); Renderable<?> render(Template template, Map<String, Object> parameters); Renderable<?> render(Template template, Object... parameters); Renderable<?> render(Template template);  }### Answer:
@Test public void testEmptyTemplateRendering() { EmptyController controller = new EmptyController(); Context context = mock(Context.class); Context.CONTEXT.set(context); Template template = mock(Template.class); controller.render(template); verify(template, times(1)).render(controller); }
@Test public void testTemplateRenderingWithMap() { EmptyController controller = new EmptyController(); Context context = mock(Context.class); Context.CONTEXT.set(context); Template template = mock(Template.class); Map<String, Object> parameters = ImmutableMap.<String, Object>of("foo", "bar"); controller.render(template, parameters); verify(template, times(1)).render(controller, parameters); }
@Test public void testTemplateRenderingWithVarAgs() { EmptyController controller = new EmptyController(); Context context = mock(Context.class); Context.CONTEXT.set(context); Template template = mock(Template.class); Object[] parameters = new Object[]{"foo", "bar", "baz", 1}; controller.render(template, parameters); verify(template, times(1)).render(any(Controller.class), any(Map.class)); }
@Test public void testIllegalTemplateRenderingWithVarAgs() { EmptyController controller = new EmptyController(); Context context = mock(Context.class); Context.CONTEXT.set(context); Template template = mock(Template.class); Object[] parameters = new Object[]{"foo", "bar", 1, "baz"}; try { controller.render(template, parameters); fail("The third argument should have been seen as illegal"); } catch (IllegalArgumentException e) { } parameters = new Object[]{"foo", "bar", "baz"}; try { controller.render(template, parameters); fail("The fourth argument is missing, it should have been detected"); } catch (IllegalArgumentException e) { } }