@Test void testUpdatePropsPanel(final FxRobot robot) { final VBox propsPanel = robot.lookup("#propPanel").query(); final CtElement stub = Mockito.mock(CtElement.class); Mockito.when(stub.getAnnotations()).thenReturn(List.of()); Mockito.when(stub.getDocComment()).thenReturn("comment"); Mockito.when(stub.getShortRepresentation()).thenReturn("rep"); Mockito.when(stub.getPosition()).thenReturn(null); Mockito.when(stub.isImplicit()).thenReturn(true); Mockito.when(stub.getReferencedTypes()).thenReturn(Set.of()); Mockito.when(stub.getComments()).thenReturn(List.of()); Mockito.when(stub.getParent()).thenReturn(null); Platform.runLater(() -> spoonCodeInstrument.updatePropertiesPanel(stub)); WaitForAsyncUtils.waitForFxEvents(); assertThat(propsPanel.getChildren().size()).isEqualTo(1); assertThat(propsPanel.getChildren().get(0)).isInstanceOf(VBox.class); assertThat(((VBox) propsPanel.getChildren().get(0)).getChildren().size()).isEqualTo(2); assertThat(((VBox) propsPanel.getChildren().get(0)).getChildren().get(0)).isInstanceOf(Text.class); assertThat(((VBox) propsPanel.getChildren().get(0)).getChildren().get(1)).isInstanceOf(TableView.class); }
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);  }