@Test(expected = ConfigurationModeNotFoundException.class) public void env_no_mode() throws IOException { // Renderer when(httpRendererService.getRenderer(ConfigurationSet.class, MODE)) .thenThrow(new RendererNotFoundException(ConfigurationSet.class, MODE)); // Call MockHttpServletResponse response = new MockHttpServletResponse(); get.env(APP_NAME, VERSION, ENV, MODE, VARIANT, response); }
@Test public void env() throws IOException { // Renderer @SuppressWarnings("unchecked") HttpRenderer<ConfigurationSet> renderer = mock(HttpRenderer.class); when(httpRendererService.getRenderer(ConfigurationSet.class, MODE)).thenReturn(renderer); // Call MockHttpServletResponse response = new MockHttpServletResponse(); get.env(APP_NAME, VERSION, ENV, MODE, VARIANT, response); // Checks the render call verify(renderer, times(1)).renderer(any(ConfigurationSet.class), eq(VARIANT), same(response)); }