use of com.google.gwt.inject.rebind.binding.Dependency in project google-gin by gwtplus.
the class DependencyExplorerTest method testAlreadyBoundInParent.
public void testAlreadyBoundInParent() throws Exception {
GinjectorBindings parent = control.createMock("parent", GinjectorBindings.class);
expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
expect(origin.isPinned(foo())).andReturn(false).anyTimes();
expect(origin.isBound(foo())).andReturn(false).anyTimes();
expect(origin.getParent()).andReturn(parent).anyTimes();
expect(parent.getParent()).andReturn(null);
expect(parent.isBound(foo())).andReturn(true);
control.replay();
DependencyExplorerOutput output = dependencyExplorer.explore(origin);
assertSame(parent, output.getPreExistingLocations().get(foo()));
control.verify();
}
use of com.google.gwt.inject.rebind.binding.Dependency in project google-gin by gwtplus.
the class EagerCycleFinderTest method testCycleAfterProvider.
public void testCycleAfterProvider() throws Exception {
eagerCycleFinder.reportError(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE), new Dependency(foo(), bar(), false, true, SOURCE)), TestUtils.dependencyList(new Dependency(bar(), baz(), SOURCE), new Dependency(baz(), bar(), SOURCE)));
expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
control.replay();
DependencyGraph graph = new DependencyGraph.Builder(origin).addEdge(new Dependency(Dependency.GINJECTOR, foo(), SOURCE)).addEdge(new Dependency(foo(), bar(), false, true, SOURCE)).addEdge(new Dependency(bar(), baz(), SOURCE)).addEdge(new Dependency(baz(), bar(), SOURCE)).build();
assertTrue(eagerCycleFinder.findAndReportCycles(graph));
control.verify();
}
use of com.google.gwt.inject.rebind.binding.Dependency in project google-gin by gwtplus.
the class EagerCycleFinderTest method testOnlyReportedOnce.
public void testOnlyReportedOnce() throws Exception {
errorManager.logError(isA(String.class), isA(Object.class), isA(Object.class));
expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE), new Dependency(Dependency.GINJECTOR, bar(), SOURCE)));
control.replay();
DependencyGraph graph = new DependencyGraph.Builder(origin).addEdge(new Dependency(Dependency.GINJECTOR, foo(), SOURCE)).addEdge(new Dependency(foo(), bar(), SOURCE)).addEdge(new Dependency(bar(), foo(), SOURCE)).build();
assertTrue(eagerCycleFinder.findAndReportCycles(graph));
control.verify();
}
use of com.google.gwt.inject.rebind.binding.Dependency in project google-gin by gwtplus.
the class EagerCycleFinderTest method testEagerCycleInUnresolved.
public void testEagerCycleInUnresolved() throws Exception {
eagerCycleFinder.reportError(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE)), TestUtils.dependencyList(new Dependency(foo(), bar(), SOURCE), new Dependency(bar(), foo(), SOURCE)));
expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE), new Dependency(foo(), bar(), SOURCE)));
control.replay();
DependencyGraph graph = new DependencyGraph.Builder(origin).addEdge(new Dependency(Dependency.GINJECTOR, foo(), SOURCE)).addEdge(new Dependency(foo(), bar(), SOURCE)).addEdge(new Dependency(bar(), foo(), SOURCE)).build();
assertTrue(eagerCycleFinder.findAndReportCycles(graph));
control.verify();
}
use of com.google.gwt.inject.rebind.binding.Dependency in project google-gin by gwtplus.
the class EagerCycleFinderTest method testNotEagerCycle.
public void testNotEagerCycle() throws Exception {
expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
control.replay();
DependencyGraph graph = new DependencyGraph.Builder(origin).addEdge(new Dependency(Dependency.GINJECTOR, foo(), SOURCE)).addEdge(new Dependency(foo(), bar(), SOURCE)).addEdge(new Dependency(bar(), foo(), false, true, SOURCE)).build();
assertFalse(eagerCycleFinder.findAndReportCycles(graph));
control.verify();
}
Aggregations