use of cn.taketoday.web.handler.mvc.ParameterizableViewController in project today-framework by TAKETODAY.
the class ViewControllerRegistryTests method addViewController.
@Test
public void addViewController() {
this.registry.addViewController("/path").setViewName("viewName");
ParameterizableViewController controller = getController("/path");
assertThat(controller.getViewName()).isEqualTo("viewName");
assertThat(controller.getStatusCode()).isNull();
assertThat(controller.isStatusOnly()).isFalse();
assertThat(controller.getApplicationContext()).isNotNull();
}
use of cn.taketoday.web.handler.mvc.ParameterizableViewController in project today-framework by TAKETODAY.
the class ViewControllerRegistryTests method addStatusController.
@Test
public void addStatusController() {
this.registry.addStatusController("/path", HttpStatus.NOT_FOUND);
ParameterizableViewController controller = getController("/path");
assertThat(controller.getViewName()).isNull();
assertThat(controller.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
assertThat(controller.isStatusOnly()).isTrue();
assertThat(controller.getApplicationContext()).isNotNull();
}
use of cn.taketoday.web.handler.mvc.ParameterizableViewController in project today-framework by TAKETODAY.
the class ViewControllerRegistryTests method getController.
private ParameterizableViewController getController(String path) {
Map<String, ?> urlMap = this.registry.buildHandlerMapping().getUrlMap();
ParameterizableViewController controller = (ParameterizableViewController) urlMap.get(path);
assertThat(controller).isNotNull();
return controller;
}
use of cn.taketoday.web.handler.mvc.ParameterizableViewController in project today-framework by TAKETODAY.
the class ViewControllerRegistryTests method addViewControllerWithDefaultViewName.
@Test
public void addViewControllerWithDefaultViewName() {
this.registry.addViewController("/path");
ParameterizableViewController controller = getController("/path");
assertThat(controller.getViewName()).isNull();
assertThat(controller.getStatusCode()).isNull();
assertThat(controller.isStatusOnly()).isFalse();
assertThat(controller.getApplicationContext()).isNotNull();
}
use of cn.taketoday.web.handler.mvc.ParameterizableViewController in project today-framework by TAKETODAY.
the class ViewControllerRegistryTests method getRedirectView.
private RedirectView getRedirectView(String path) {
ParameterizableViewController controller = getController(path);
assertThat(controller.getViewName()).isNull();
assertThat(controller.getView()).isNotNull();
assertThat(controller.getView().getClass()).isEqualTo(RedirectView.class);
return (RedirectView) controller.getView();
}
Aggregations