1
JavaFX Filechooser를 가져 오는 메소드에 대해 JUNIT 테스트를 작성하려면 어떻게해야합니까? 단위 테스트는 FilechooserUnit to Unit JavaFX Filechooser로 메소드 테스트
@Test
public void testGetPath() {
try {
myController mc= new myController();
String s = uiController.getPath();
assertNotNull(s);
}
public String getPath() {
String s = "";
Task<Void> t = new Task<Void>() {
@Override
protected Void call() throws Exception {
FileChooser myFileChooser = new FileChooser ("/home/default");
File file = myFileChooser.showSaveDialog(appStage);
if (file != null) {
s = file.getAbsolutePath().toString();
}
}
};
Platform.runLater(t);
while (!t.isDone())
;
return s;
}