FxWeaver { public <C, V extends Node> FxControllerAndView<C, V> load(Class<C> controllerClass) { return load(controllerClass, null); } FxWeaver(Callback<Class<?>, Object> beanFactory, Runnable closeCommand); V loadView(Class<C> controllerClass); V loadView(Class<C> controllerClass, ResourceBundle resourceBundle); V loadView(Class<C> controllerClass, String location); V loadView(Class<C> controllerClass, String location, ResourceBundle resourceBundle); C loadController(Class<C> controllerClass, String location); C loadController(Class<C> controllerClass, String location, ResourceBundle resourceBundle); C loadController(Class<C> controllerClass); C loadController(Class<C> controllerClass, ResourceBundle resourceBundle); C getBean(Class<C> beanType); FxControllerAndView<C, V> load(Class<C> controllerClass); FxControllerAndView<C, V> load(Class<C> controllerClass,
                                                              ResourceBundle resourceBundle); void shutdown();  }
@Test public void loadReturnsControllerWhenNoViewCanBeFound() throws Exception { FxControllerAndView<SimpleBean, Node> load = fxWeaver.load(SimpleBean.class, null, null); assertThat(load).isNotNull(); assertThat(load.getController()).isNotNull().isInstanceOf(SimpleBean.class); }
@Test public void loadControllerAndViewWorksWithValidView() throws Exception { FxControllerAndView<SimpleBean, Pane> cav = fxWeaver.load(SimpleBean.class, "/net/rgielen/fxweaver/core/foo.fxml", null); assertThat(cav).isNotNull(); assertThat(cav.getController()).isNotNull().isInstanceOfAny(SimpleBean.class); assertThat(cav.getView()).isPresent(); assertThat(cav.getView().get()).isInstanceOfAny(Pane.class); }
@Test public void loadControllerAndViewThrowsExceptionForValidView() throws Exception { assertThatThrownBy( () -> fxWeaver.load(SimpleBean.class, "/net/rgielen/fxweaver/core/notvalid.fxml", null) ).isInstanceOf(FxLoadException.class); }