InjectorImpl implements Injector { @Override public <T> T getAfterOrThrow(Class<T> type, T before) { return getAfter(type, before).orElseThrow(() -> new IllegalArgumentException("A component after " + before + " of type " + type.getName() + " could not be found. Components of type " + type.getSimpleName() + ": " + stream(type).map(Object::getClass).map(Class::getSimpleName).collect(Collectors.joining(", "))) ); } InjectorImpl(
        final Set<Injectable<?>> injectables,
        final List<Object> instances,
        final Properties properties,
        final ClassLoader classLoader,
        final DependencyGraph graph,
        final InjectorBuilder builder
    ); static InjectorBuilder builder(); static InjectorBuilder builder(ClassLoader classLoader); @Override Stream<T> stream(Class<T> type); @Override T getOrThrow(Class<T> type); @Override T getAfterOrThrow(Class<T> type, T before); @Override Optional<T> get(Class<T> type); @Override Optional<T> getAfter(Class<T> type, T before); @Override Stream<Class<?>> injectables(); @Override T inject(T instance); @Override ClassLoader classLoader(); @Override void stop(); @Override InjectorBuilder newBuilder(); static final Logger LOGGER_INSTANCE; }
@Test void getAfterOrThrow() { final Foo expected = injector.getOrThrow(Bar.class); final Baz baz = injector.getOrThrow(Baz.class); final Foo actual = injector.getAfterOrThrow(Foo.class, baz); assertEquals(expected, actual); final Bar bar = injector.getOrThrow(Bar.class); assertThrows(IllegalArgumentException.class, () -> injector.getAfterOrThrow(Foo.class, bar)); }