@Test void testCopy(final FxRobot robot) { final VBox propsPanel = robot.lookup("#propPanel").query(); final CtElement stub = Mockito.mock(CtElement.class); final ClipboardContent clipboardContent = new ClipboardContent(); clipboardContent.putString(""); Platform.runLater(() -> Clipboard.getSystemClipboard().setContent(clipboardContent)); WaitForAsyncUtils.waitForFxEvents(); Platform.runLater(() -> spoonCodeInstrument.updatePropertiesPanel(stub)); WaitForAsyncUtils.waitForFxEvents(); robot.clickOn(((VBox) propsPanel.getChildren().get(0)).getChildren().get(1)); robot.press(KeyCode.CONTROL).type(KeyCode.C).release(KeyCode.CONTROL); WaitForAsyncUtils.waitForFxEvents(); final AtomicReference<Object> content = new AtomicReference<>(); Platform.runLater(() -> content.set(Clipboard.getSystemClipboard().getContent(DataFormat.PLAIN_TEXT))); WaitForAsyncUtils.waitForFxEvents(); AssertionsForClassTypes.assertThat(content.get()).isInstanceOf(String.class); AssertionsForClassTypes.assertThat((String) content.get()).isNotEmpty(); }
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);  }