/*
 * Copyright 2015-2019 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v2.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v20.html
 */

package org.junit.jupiter.api.extension;

import static org.apiguardian.api.API.Status.EXPERIMENTAL;

import java.util.Optional;

import org.apiguardian.api.API;

TestInstanceFactoryContext encapsulates the context in which a test class is to be instantiated by a TestInstanceFactory.
See Also:
Since:5.3
/** * {@code TestInstanceFactoryContext} encapsulates the <em>context</em> in which * a {@linkplain #getTestClass test class} is to be instantiated by a * {@link TestInstanceFactory}. * * @since 5.3 * @see TestInstanceFactory */
@API(status = EXPERIMENTAL, since = "5.3") public interface TestInstanceFactoryContext {
Get the test class for this context.
Returns:the test class to be instantiated; never null
/** * Get the test class for this context. * * @return the test class to be instantiated; never {@code null} */
Class<?> getTestClass();
Get the instance of the outer class, if available.

The returned Optional will be empty unless the current test class is a @Nested test class.

See Also:
Returns:an Optional containing the outer test instance; never null but potentially empty
/** * Get the instance of the outer class, if available. * * <p>The returned {@link Optional} will be <em>empty</em> unless the * current {@linkplain #getTestClass() test class} is a * {@link org.junit.jupiter.api.Nested @Nested} test class. * * @return an {@code Optional} containing the outer test instance; never * {@code null} but potentially empty * @see org.junit.jupiter.api.Nested */
Optional<Object> getOuterInstance(); }