DependencyGraphImpl implements DependencyGraph { @Override public DependencyNode getOrCreate(Class<?> clazz) { return getIfPresent(clazz) .orElseGet(() -> nodes.computeIfAbsent(clazz, DependencyNodeImpl::new)); } 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 getOrCreate() { final DependencyNode dependencyNode = instance.getOrCreate(Foo.class); assertEquals(Foo.class, dependencyNode.getRepresentedType()); }