Bind ViewFactory interface to GuiceViewFactory impl

This change fixes a test that was breaking in the previous commit.
This commit is contained in:
Chris Beams 2014-11-24 07:32:37 +01:00
parent e8afdf5e22
commit 87fb4390c4
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73
2 changed files with 7 additions and 6 deletions

View File

@ -31,6 +31,7 @@ import io.bitsquare.gui.util.validation.PasswordValidator;
import com.google.inject.name.Names;
import viewfx.view.ViewFactory;
import viewfx.view.support.ViewLoader;
import viewfx.view.support.guice.GuiceViewFactory;
@ -49,7 +50,7 @@ public class GuiModule extends BitsquareModule {
@Override
protected void configure() {
bind(GuiceViewFactory.class).asEagerSingleton();
bind(ViewFactory.class).to(GuiceViewFactory.class).asEagerSingleton();
bind(ViewLoader.class).asEagerSingleton();
bind(OfferBook.class).asEagerSingleton();

View File

@ -62,24 +62,24 @@ public class ViewLoaderTests {
Thread.sleep(10);
}
private GuiceViewFactory controllerFactory;
private GuiceViewFactory viewFactory;
@Before
public void setUp() {
OptionParser parser = new OptionParser();
BitsquareEnvironment env = new BitsquareEnvironment(parser.parse(new String[]{}));
Injector injector = Guice.createInjector(new BitsquareAppModule(env, TestApp.primaryStage));
controllerFactory = injector.getInstance(GuiceViewFactory.class);
controllerFactory.setInjector(injector);
viewFactory = injector.getInstance(GuiceViewFactory.class);
viewFactory.setInjector(injector);
}
@Test(expected = BitsquareException.class)
public void loadingBogusFxmlResourceShouldThrow() throws MalformedURLException {
new ViewLoader(controllerFactory).load(Navigation.Item.BOGUS.getFxmlUrl(), false);
new ViewLoader(viewFactory).load(Navigation.Item.BOGUS.getFxmlUrl(), false);
}
@Test
public void loadingValidFxmlResourceShouldNotThrow() {
new ViewLoader(controllerFactory).load(Navigation.Item.ACCOUNT.getFxmlUrl(), false);
new ViewLoader(viewFactory).load(Navigation.Item.ACCOUNT.getFxmlUrl(), false);
}
}