// Path: src/test/java/com/cathive/fx/guice/example/ExamplePaneController.java
// @FXMLController
// public class ExamplePaneController implements Initializable {
// 
// 	private List<String> methodCalls = new ArrayList<>();
// 
// 	private boolean initialized = false;
// 	private boolean injected = false;
// 
// 	@FXML private AnchorPane rootPane;
// 
// 	@Inject private void postConstruct() {
// 		methodCalls.add("postConstruct()");
// 		this.injected = true;
// 	}
// 
// 	@Override public void initialize(URL url, ResourceBundle rb) {
// 		methodCalls.add("initialize(java.net.URL, java.util.ResourceBundle)");
// 		this.initialized = true;
// 	}
// 
// 	public boolean isInitialized() {
// 		return this.initialized;
// 	}
// 
// 	public boolean isInjected() {
// 		return this.injected;
// 	}
// 
// 	public List<String> getMethodCalls() {
// 		return this.methodCalls;
// 	}
// 
// 	public AnchorPane getRootPane() {
// 		return this.rootPane;
// 	}
// 
// }


import org.testng.annotations.Test;
import com.cathive.fx.guice.example.ExamplePaneController;
import com.google.inject.Injector;
import com.google.inject.Module;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import java.util.List;
import java.util.ResourceBundle;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import org.mockito.Mockito;
import org.testng.annotations.BeforeClass;
    public void fxmlLoadingTestWithNullParams() throws Exception {
        fxmlLoader.load(null);
    }

    @Test(dependsOnMethods = "instantiationViaGuiceTest")
    public void fxmlControllerInstantiationTest() throws Exception {
        // Fetches an instance of the ExamplePaneController and makes sure it is not (yet) initialized.
        ctrl = injector.getInstance(ExamplePaneController.class);
        assertNotNull(ctrl);
        assertTrue(ctrl.isInjected());
        assertFalse(ctrl.isInitialized());
        assertNull(ctrl.getRootPane());
        assertTrue(ctrl.getMethodCalls().contains("postConstruct()"));
        assertEquals(ctrl.getMethodCalls().size(), 1);
    }

    @Test(dependsOnMethods = "fxmlControllerInstantiationTest")
    public void fxmlLoadingTest() throws Exception {

        // Load the FXML file and check that afterwards the controller must be initialized.
        final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource("/ExamplePane.fxml"),
                ResourceBundle.getBundle("ExamplePane"));
        assertNotNull(result);
        final AnchorPane pane = result.getRoot(); 
        ctrl = result.getController();

        assertTrue(ctrl.isInitialized());
        assertNotNull(ctrl.getRootPane());
        assertEquals(ctrl.getRootPane(), pane);
        assertTrue(ctrl.getMethodCalls().contains("initialize(java.net.URL, java.util.ResourceBundle)"));
// Path: src/test/java/com/cathive/fx/guice/example/ExamplePaneController.java
// @FXMLController
// public class ExamplePaneController implements Initializable {
// 
// 	private List<String> methodCalls = new ArrayList<>();
// 
// 	private boolean initialized = false;
// 	private boolean injected = false;
// 
// 	@FXML private AnchorPane rootPane;
// 
// 	@Inject private void postConstruct() {
// 		methodCalls.add("postConstruct()");
// 		this.injected = true;
// 	}
// 
// 	@Override public void initialize(URL url, ResourceBundle rb) {
// 		methodCalls.add("initialize(java.net.URL, java.util.ResourceBundle)");
// 		this.initialized = true;
// 	}
// 
// 	public boolean isInitialized() {
// 		return this.initialized;
// 	}
// 
// 	public boolean isInjected() {
// 		return this.injected;
// 	}
// 
// 	public List<String> getMethodCalls() {
// 		return this.methodCalls;
// 	}
// 
// 	public AnchorPane getRootPane() {
// 		return this.rootPane;
// 	}
// 
// }


// Path: src/test/java/com/cathive/fx/guice/GuiceFXMLLoaderTest.java
import org.testng.annotations.Test;
import com.cathive.fx.guice.example.ExamplePaneController;
import com.google.inject.Injector;
import com.google.inject.Module;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import java.util.List;
import java.util.ResourceBundle;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import org.mockito.Mockito;
import org.testng.annotations.BeforeClass;

    public void fxmlLoadingTestWithNullParams() throws Exception {
        fxmlLoader.load(null);
    }

    @Test(dependsOnMethods = "instantiationViaGuiceTest")
    public void fxmlControllerInstantiationTest() throws Exception {
        // Fetches an instance of the ExamplePaneController and makes sure it is not (yet) initialized.
        ctrl = injector.getInstance(ExamplePaneController.class);
        assertNotNull(ctrl);
        assertTrue(ctrl.isInjected());
        assertFalse(ctrl.isInitialized());
        assertNull(ctrl.getRootPane());
        assertTrue(ctrl.getMethodCalls().contains("postConstruct()"));
        assertEquals(ctrl.getMethodCalls().size(), 1);
    }

    @Test(dependsOnMethods = "fxmlControllerInstantiationTest")
    public void fxmlLoadingTest() throws Exception {

        // Load the FXML file and check that afterwards the controller must be initialized.
        final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource("/ExamplePane.fxml"),
                ResourceBundle.getBundle("ExamplePane"));
        assertNotNull(result);
        final AnchorPane pane = result.getRoot(); 
        ctrl = result.getController();

        assertTrue(ctrl.isInitialized());
        assertNotNull(ctrl.getRootPane());
        assertEquals(ctrl.getRootPane(), pane);
        assertTrue(ctrl.getMethodCalls().contains("initialize(java.net.URL, java.util.ResourceBundle)"));
        assertEquals(ctrl.getMethodCalls().size(), 2);