DependencyGraphImpl implements DependencyGraph { @Override public DependencyGraph inject() { nodes.forEach((clazz, node) -> { traverseMethods(clazz) .filter(m -> m.isAnnotationPresent(Execute.class)) .forEach(m -> node.getExecutions().add(createExecution(m, State.STARTED))); traverseMethods(clazz) .filter(m -> m.isAnnotationPresent(ExecuteBefore.class)) .forEach(m -> { final ExecuteBefore execute = m.getAnnotation(ExecuteBefore.class); node.getExecutions() .add(createExecution(m, execute.value())); }); }); return this; } DependencyGraphImpl(Function<Class<?>, InjectorProxy> proxyFunction); @Override DependencyNode get(Class<?> clazz); @Override DependencyNode getOrCreate(Class<?> clazz); @Override Optional<DependencyNode> getIfPresent(Class<?> clazz); @Override DependencyGraph inject(); @Override Stream<DependencyNode> nodes();  }
@Test void inject() { instance.getOrCreate(Foo.class); final DependencyGraph dependencyGraph = instance.inject(); final DependencyNode dependencyNode = dependencyGraph.get(Foo.class); assertEquals(2, dependencyNode.getExecutions().size()); }