Search in sources :

Example 6 with BindingCreationException

use of com.google.gwt.inject.rebind.resolution.ImplicitBindingCreator.BindingCreationException in project google-gin by gwtplus.

the class BindingResolverTest method testFailToResolveDependency.

public void testFailToResolveDependency() throws Exception {
    StandardTree tree = createExampleTree();
    expectCreateBinding(foo(), required(foo(), bar()));
    expect(bindingCreator.create(bar())).andThrow(new BindingCreationException("Unable to create"));
    errorManager.logError(isA(String.class), eq(bar()), isA(String.class), isA(List.class));
    replayAndResolve(tree.childLL, required(Dependency.GINJECTOR, foo()));
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) BindingCreationException(com.google.gwt.inject.rebind.resolution.ImplicitBindingCreator.BindingCreationException)

Example 7 with BindingCreationException

use of com.google.gwt.inject.rebind.resolution.ImplicitBindingCreator.BindingCreationException in project google-gin by gwtplus.

the class BindingResolverTest method testResolveBindingWithOptionalDependency_DepFails.

public void testResolveBindingWithOptionalDependency_DepFails() throws Exception {
    StandardTree tree = createExampleTree();
    // Baz is optional and fails to resolve
    Binding fooBinding = expectCreateBinding(foo(), required(foo(), bar()), optional(foo(), baz()));
    expect(bindingCreator.create(baz())).andThrow(new BindingCreationException("Unable to create"));
    bind(bar(), tree.root);
    tree.root.addBinding(foo(), fooBinding);
    // childLL gets foo from childL
    expectParentBinding(foo(), tree.root, tree.childLL);
    replayAndResolve(tree.childLL, required(Dependency.GINJECTOR, foo()));
}
Also used : ExposedChildBinding(com.google.gwt.inject.rebind.binding.ExposedChildBinding) Binding(com.google.gwt.inject.rebind.binding.Binding) ParentBinding(com.google.gwt.inject.rebind.binding.ParentBinding) BindingCreationException(com.google.gwt.inject.rebind.resolution.ImplicitBindingCreator.BindingCreationException)

Aggregations

BindingCreationException (com.google.gwt.inject.rebind.resolution.ImplicitBindingCreator.BindingCreationException)7 Binding (com.google.gwt.inject.rebind.binding.Binding)3 ExposedChildBinding (com.google.gwt.inject.rebind.binding.ExposedChildBinding)3 Dependency (com.google.gwt.inject.rebind.binding.Dependency)2 ParentBinding (com.google.gwt.inject.rebind.binding.ParentBinding)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 GinjectorBindings (com.google.gwt.inject.rebind.GinjectorBindings)1 DependencyExplorerOutput (com.google.gwt.inject.rebind.resolution.DependencyExplorer.DependencyExplorerOutput)1