DependencyGraphImpl implements DependencyGraph { @Override public DependencyNode get(Class<?> clazz) { return getIfPresent(clazz).orElseThrow(() -> new IllegalArgumentException( format("There is no implementation of '%s' in the injection dependency graph.", clazz) )); } 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 get() { assertThrows(IllegalArgumentException.class, () -> instance.get(Foo.class)); instance.getOrCreate(Foo.class); final DependencyNode dependencyNode = instance.get(Foo.class); assertEquals(Foo.class, dependencyNode.getRepresentedType()); }