@Test void testCPath(final FxRobot robot) { final VBox propsPanel = robot.lookup("#propPanel").query(); final CtElement stub = Mockito.mock(CtElement.class); final CtPath path = Mockito.mock(CtPath.class); Mockito.when(stub.getPath()).thenReturn(path); Mockito.when(path.toString()).thenReturn("#thePath"); Platform.runLater(() -> spoonCodeInstrument.updatePropertiesPanel(stub)); WaitForAsyncUtils.waitForFxEvents(); final VBox box = (VBox) propsPanel.getChildren().get(0); assertThat(box.getChildren().get(0)).isInstanceOf(Text.class); assertThat(((Text) box.getChildren().get(0)).getText()).isEqualTo("Path"); assertThat(box.getChildren().get(1)).isInstanceOf(TextField.class); assertThat(((TextField) box.getChildren().get(1)).getText()).isEqualTo("#thePath"); }
void updatePropertiesPanel(final CtElement elt) { final List<Pair<Class<?>, Set<Pair<String, String>>>> props = getSpoonProperties(elt); propPanel.getChildren().clear(); final CtPath path = elt.getPath(); if(path != null) { final TextField tf = new TextField(path.toString()); tf.setEditable(false); propPanel.getChildren().add(new VBox(createTitleText("Path"), tf)); } propPanel.getChildren().addAll( props .stream() .map(pair -> { final VBox vBox = new VBox(createTitleText(pair.getKey().getName()), createTable(pair.getValue())); vBox.prefWidthProperty().bind(scrollPaneProps.widthProperty()); return vBox; }) .collect(Collectors.toList()) ); }
SpoonCodeInstrument extends JfxInstrument implements Initializable { void updatePropertiesPanel(final CtElement elt) { final List<Pair<Class<?>, Set<Pair<String, String>>>> props = getSpoonProperties(elt); propPanel.getChildren().clear(); final CtPath path = elt.getPath(); if(path != null) { final TextField tf = new TextField(path.toString()); tf.setEditable(false); propPanel.getChildren().add(new VBox(createTitleText("Path"), tf)); } propPanel.getChildren().addAll( props .stream() .map(pair -> { final VBox vBox = new VBox(createTitleText(pair.getKey().getName()), createTable(pair.getValue())); vBox.prefWidthProperty().bind(scrollPaneProps.widthProperty()); return vBox; }) .collect(Collectors.toList()) ); } }
SpoonCodeInstrument extends JfxInstrument implements Initializable { void updatePropertiesPanel(final CtElement elt) { final List<Pair<Class<?>, Set<Pair<String, String>>>> props = getSpoonProperties(elt); propPanel.getChildren().clear(); final CtPath path = elt.getPath(); if(path != null) { final TextField tf = new TextField(path.toString()); tf.setEditable(false); propPanel.getChildren().add(new VBox(createTitleText("Path"), tf)); } propPanel.getChildren().addAll( props .stream() .map(pair -> { final VBox vBox = new VBox(createTitleText(pair.getKey().getName()), createTable(pair.getValue())); vBox.prefWidthProperty().bind(scrollPaneProps.widthProperty()); return vBox; }) .collect(Collectors.toList()) ); }  }
SpoonCodeInstrument extends JfxInstrument implements Initializable { void updatePropertiesPanel(final CtElement elt) { final List<Pair<Class<?>, Set<Pair<String, String>>>> props = getSpoonProperties(elt); propPanel.getChildren().clear(); final CtPath path = elt.getPath(); if(path != null) { final TextField tf = new TextField(path.toString()); tf.setEditable(false); propPanel.getChildren().add(new VBox(createTitleText("Path"), tf)); } propPanel.getChildren().addAll( props .stream() .map(pair -> { final VBox vBox = new VBox(createTitleText(pair.getKey().getName()), createTable(pair.getValue())); vBox.prefWidthProperty().bind(scrollPaneProps.widthProperty()); return vBox; }) .collect(Collectors.toList()) ); }  @Override void initialize(final URL url, final ResourceBundle res); }
SpoonCodeInstrument extends JfxInstrument implements Initializable { void updatePropertiesPanel(final CtElement elt) { final List<Pair<Class<?>, Set<Pair<String, String>>>> props = getSpoonProperties(elt); propPanel.getChildren().clear(); final CtPath path = elt.getPath(); if(path != null) { final TextField tf = new TextField(path.toString()); tf.setEditable(false); propPanel.getChildren().add(new VBox(createTitleText("Path"), tf)); } propPanel.getChildren().addAll( props .stream() .map(pair -> { final VBox vBox = new VBox(createTitleText(pair.getKey().getName()), createTable(pair.getValue())); vBox.prefWidthProperty().bind(scrollPaneProps.widthProperty()); return vBox; }) .collect(Collectors.toList()) ); }  @Override void initialize(final URL url, final ResourceBundle res);  }