Skip to content

Instantly share code, notes, and snippets.

@ryanjaeb
Created September 12, 2014 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanjaeb/0222f5169a2ec944059e to your computer and use it in GitHub Desktop.
Save ryanjaeb/0222f5169a2ec944059e to your computer and use it in GitHub Desktop.
package fx.fxml.view.fxml;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import org.junit.Test;
import org.loadui.testfx.GuiTest;
import org.mockito.Mockito;
import java.io.IOException;
public class MainPaneControllerTest extends GuiTest {
private MainPaneController controller;
@Override
protected Parent getRootNode() {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(MainPaneController.class.getResource("MainPane.fxml"));
loader.setControllerFactory(type -> Mockito.spy(new MainPaneController()));
try {
Parent root = loader.load();
controller = loader.getController();
return root;
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
@Test
public void selectedLeftItemIsBound() {
controller.getLeftListView().getItems().add("test item");
click("test item");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment