@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/path").setViewName("view"); registry.addRedirectViewController("/old", "/new").setStatusCode(HttpStatus.PERMANENT_REDIRECT); registry.addStatusController("/bad", HttpStatus.NOT_FOUND); }
@Test public void addStatusController() { this.registry.addStatusController("/path", HttpStatus.NOT_FOUND); ParameterizableViewController controller = getController("/path"); assertNull(controller.getViewName()); assertEquals(HttpStatus.NOT_FOUND, controller.getStatusCode()); assertTrue(controller.isStatusOnly()); assertNotNull(controller.getApplicationContext()); }