@Test public void InvertedTreeDependency() throws Exception { runTest(new InvertedTreeDependencyController()); assertInvokedBefore("getC1", "getA", "getB1"); assertInvokedBefore("getC2", "getA", "getB1"); assertInvokedBefore("getC3", "getA", "getB2"); assertInvokedBefore("getC4", "getA", "getB2"); assertInvokedBefore("getB1", "getA"); assertInvokedBefore("getB2", "getA"); }
@Test public void straightLineDependency() throws Exception { runTest(new StraightLineDependencyController()); assertInvokedBefore("getA", "getB1", "getB2", "getC1", "getC2", "getC3", "getC4"); assertInvokedBefore("getB1", "getB2", "getC1", "getC2", "getC3", "getC4"); assertInvokedBefore("getB2", "getC1", "getC2", "getC3", "getC4"); assertInvokedBefore("getC1", "getC2", "getC3", "getC4"); assertInvokedBefore("getC2", "getC3", "getC4"); assertInvokedBefore("getC3", "getC4"); }
@Test public void treeDependency() throws Exception { runTest(new TreeDependencyController()); assertInvokedBefore("getA", "getB1", "getB2", "getC1", "getC2", "getC3", "getC4"); assertInvokedBefore("getB1", "getC1", "getC2"); assertInvokedBefore("getB2", "getC3", "getC4"); }
@Test public void unresolvedDependency() throws Exception { runTest(new UnresolvedDependencyController()); assertInvokedBefore("getA", "getC1", "getC2", "getC3", "getC4"); // No other order guarantees for methods with unresolvable dependencies (and methods that depend on them), // Required dependencies will be created via default constructor. }