// Path: src/test/java/com/cathive/fx/guice/example/SimpleFXMLComponent.java
// @FXMLComponent(location = "/SimpleFXMLComponent.fxml", resources = "SimpleFXMLComponent")
// public final class SimpleFXMLComponent extends VBox {
// 
//     private final IntegerProperty theAnswerToEverything = new SimpleIntegerProperty();
// 
//     @Inject private Injector injector;
// 
//     @FXML private URL location;
//     @FXML private ResourceBundle resources;
// 
//     @FXML private Button button;
//     @FXML private Label label;
// 
//     private boolean initialized = false;
// 
//     public SimpleFXMLComponent() {
//         super();
//     }
// 
//     public Injector getInjector() {
//         return this.injector;
//     }
// 
//     public void initialize() {
//         this.initialized = true;
//     }
// 
//     public Button getButton() {
//         return this.button;
//     }
// 
//     public Label getLabel() {
//         return this.label;
//     }
// 
//     public boolean isInitialized() {
//         return this.initialized;
//     }
// 
//     public int getTheAnswerToEverything() {
//         return this.theAnswerToEverything.get();
//     }
// 
//     public void setTheAnswerToEverything(final int theAnswerToEverything) {
//         this.theAnswerToEverything.set(theAnswerToEverything);
//     }
// 
//     public IntegerProperty theAnswerToEverythingProperty() {
//         return this.theAnswerToEverything;
//     }
// 
// }
// 
// Path: src/test/java/com/cathive/fx/guice/example/ExampleFXMLComponentWrapperController.java
// @FXMLController
// public class ExampleFXMLComponentWrapperController {
// 
//     @Inject private Injector injector;
// 
//     @FXML SimpleFXMLComponent simpleComponent1;
//     @FXML SimpleFXMLComponent simpleComponent2;
// 
//     public Injector getInjector() {
//         return this.injector;
//     }
// 
//     public SimpleFXMLComponent getSimpleComponent1() {
//         return this.simpleComponent1;
//     }
// 
//     public SimpleFXMLComponent getSimpleComponent2() {
//         return this.simpleComponent2;
//     }
// 
// }
// 
// Path: src/main/java/com/cathive/fx/guice/fxml/FXMLLoadingModule.java
// public final class FXMLLoadingModule extends AbstractModule {
// 
//     public FXMLLoadingModule() {
//         super();
//     }
// 
//     @Override
//     protected void configure() {
// 
//         // FXMLLoadingScope
//         final FXMLLoadingScope fxmlLoadingScope = new FXMLLoadingScope();
//         bind(FXMLLoadingScope.class).toInstance(fxmlLoadingScope);
//         bindScope(FXMLController.class, fxmlLoadingScope);
//         bindScope(FXMLComponent.class, fxmlLoadingScope);
// 
//         // GuiceFXMLLoader
//         bind(GuiceFXMLLoader.class);
// 
//         // FXMLControllerTypeListener
//         final FXMLControllerTypeListener fxmlControllerTypeListener = new FXMLControllerTypeListener();
//         requestInjection(fxmlControllerTypeListener);
//         bind(FXMLControllerTypeListener.class).toInstance(fxmlControllerTypeListener);
//         bindListener(Matchers.any(), fxmlControllerTypeListener);
// 
//         // FXMLComponentTypeListener
//         final FXMLComponentTypeListener fxmlComponentTypeListener = new FXMLComponentTypeListener();
//         requestInjection(fxmlComponentTypeListener);
//         bind(FXMLComponentTypeListener.class).toInstance(fxmlComponentTypeListener);
//         bindListener(Matchers.any(), fxmlComponentTypeListener);
// 
//         // ControllerLookup
//         bind(ControllerLookup.class).toProvider(new ControllerLookupProvider(fxmlLoadingScope));
// 
//     }
// 
// 
//     private final class ControllerLookupProvider implements Provider<ControllerLookup> {
//         private final FXMLLoadingScope fxmlLoadingScope;
//         private ControllerLookupProvider(final FXMLLoadingScope fxmlLoadingScope) {
//             super();
//             this.fxmlLoadingScope = fxmlLoadingScope;
//         }
//         @Override
//         public ControllerLookup get() {
//             if (!fxmlLoadingScope.isActive()) {
//                 throw new IllegalStateException("A ControllerLookup instance cannot be injected while outside of the FXML Loading scope.");
//             }
//             return new ControllerLookup(fxmlLoadingScope.getIdentifiables());
//         }
//     }
// 
// }


import com.cathive.fx.guice.fxml.FXMLLoadingModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import javafx.application.Application;
import javafx.scene.Parent;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.cathive.fx.guice.example.SimpleFXMLComponent;
import com.cathive.fx.guice.example.ExampleFXMLComponentWrapperController;
/*
 * Copyright (C) 2012 The Cat Hive Developers.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cathive.fx.guice;






/**
 * 
 * @author Benjamin P. Jung
 */
// FIXME These tests are currently broken. It is necessary to fully load a
//       JavaFX application before components can be instantiated correctly.
@Test
public class FXMLComponentTest {

    private Injector injector;

    private SimpleFXMLComponent simpleComponent;

    @BeforeTest
    protected void initialize() {
// Path: src/test/java/com/cathive/fx/guice/example/SimpleFXMLComponent.java
// @FXMLComponent(location = "/SimpleFXMLComponent.fxml", resources = "SimpleFXMLComponent")
// public final class SimpleFXMLComponent extends VBox {
// 
//     private final IntegerProperty theAnswerToEverything = new SimpleIntegerProperty();
// 
//     @Inject private Injector injector;
// 
//     @FXML private URL location;
//     @FXML private ResourceBundle resources;
// 
//     @FXML private Button button;
//     @FXML private Label label;
// 
//     private boolean initialized = false;
// 
//     public SimpleFXMLComponent() {
//         super();
//     }
// 
//     public Injector getInjector() {
//         return this.injector;
//     }
// 
//     public void initialize() {
//         this.initialized = true;
//     }
// 
//     public Button getButton() {
//         return this.button;
//     }
// 
//     public Label getLabel() {
//         return this.label;
//     }
// 
//     public boolean isInitialized() {
//         return this.initialized;
//     }
// 
//     public int getTheAnswerToEverything() {
//         return this.theAnswerToEverything.get();
//     }
// 
//     public void setTheAnswerToEverything(final int theAnswerToEverything) {
//         this.theAnswerToEverything.set(theAnswerToEverything);
//     }
// 
//     public IntegerProperty theAnswerToEverythingProperty() {
//         return this.theAnswerToEverything;
//     }
// 
// }
// 
// Path: src/test/java/com/cathive/fx/guice/example/ExampleFXMLComponentWrapperController.java
// @FXMLController
// public class ExampleFXMLComponentWrapperController {
// 
//     @Inject private Injector injector;
// 
//     @FXML SimpleFXMLComponent simpleComponent1;
//     @FXML SimpleFXMLComponent simpleComponent2;
// 
//     public Injector getInjector() {
//         return this.injector;
//     }
// 
//     public SimpleFXMLComponent getSimpleComponent1() {
//         return this.simpleComponent1;
//     }
// 
//     public SimpleFXMLComponent getSimpleComponent2() {
//         return this.simpleComponent2;
//     }
// 
// }
// 
// Path: src/main/java/com/cathive/fx/guice/fxml/FXMLLoadingModule.java
// public final class FXMLLoadingModule extends AbstractModule {
// 
//     public FXMLLoadingModule() {
//         super();
//     }
// 
//     @Override
//     protected void configure() {
// 
//         // FXMLLoadingScope
//         final FXMLLoadingScope fxmlLoadingScope = new FXMLLoadingScope();
//         bind(FXMLLoadingScope.class).toInstance(fxmlLoadingScope);
//         bindScope(FXMLController.class, fxmlLoadingScope);
//         bindScope(FXMLComponent.class, fxmlLoadingScope);
// 
//         // GuiceFXMLLoader
//         bind(GuiceFXMLLoader.class);
// 
//         // FXMLControllerTypeListener
//         final FXMLControllerTypeListener fxmlControllerTypeListener = new FXMLControllerTypeListener();
//         requestInjection(fxmlControllerTypeListener);
//         bind(FXMLControllerTypeListener.class).toInstance(fxmlControllerTypeListener);
//         bindListener(Matchers.any(), fxmlControllerTypeListener);
// 
//         // FXMLComponentTypeListener
//         final FXMLComponentTypeListener fxmlComponentTypeListener = new FXMLComponentTypeListener();
//         requestInjection(fxmlComponentTypeListener);
//         bind(FXMLComponentTypeListener.class).toInstance(fxmlComponentTypeListener);
//         bindListener(Matchers.any(), fxmlComponentTypeListener);
// 
//         // ControllerLookup
//         bind(ControllerLookup.class).toProvider(new ControllerLookupProvider(fxmlLoadingScope));
// 
//     }
// 
// 
//     private final class ControllerLookupProvider implements Provider<ControllerLookup> {
//         private final FXMLLoadingScope fxmlLoadingScope;
//         private ControllerLookupProvider(final FXMLLoadingScope fxmlLoadingScope) {
//             super();
//             this.fxmlLoadingScope = fxmlLoadingScope;
//         }
//         @Override
//         public ControllerLookup get() {
//             if (!fxmlLoadingScope.isActive()) {
//                 throw new IllegalStateException("A ControllerLookup instance cannot be injected while outside of the FXML Loading scope.");
//             }
//             return new ControllerLookup(fxmlLoadingScope.getIdentifiables());
//         }
//     }
// 
// }


// Path: src/test/java/com/cathive/fx/guice/FXMLComponentTest.java
import com.cathive.fx.guice.fxml.FXMLLoadingModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import javafx.application.Application;
import javafx.scene.Parent;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.cathive.fx.guice.example.SimpleFXMLComponent;
import com.cathive.fx.guice.example.ExampleFXMLComponentWrapperController;

/*
 * Copyright (C) 2012 The Cat Hive Developers.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cathive.fx.guice;






/**
 * 
 * @author Benjamin P. Jung
 */
// FIXME These tests are currently broken. It is necessary to fully load a
//       JavaFX application before components can be instantiated correctly.
@Test
public class FXMLComponentTest {

    private Injector injector;

    private SimpleFXMLComponent simpleComponent;

    @BeforeTest
    protected void initialize() {
        this.injector = Guice.createInjector(new FXMLLoadingModule());