mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-18 14:55:53 -04:00
Bind ViewFactory interface to GuiceViewFactory impl
This change fixes a test that was breaking in the previous commit.
This commit is contained in:
parent
e8afdf5e22
commit
87fb4390c4
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user