org.junit.jupiter.api.extension.Extension Maven / Gradle / Ivy
Show all versions of junit-jupiter-api Show documentation
/*
* Copyright 2015-2024 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
*
* https://www.eclipse.org/legal/epl-v20.html
*/
package org.junit.jupiter.api.extension;
import static org.apiguardian.api.API.Status.STABLE;
import org.apiguardian.api.API;
/**
* Marker interface for all extensions.
*
* An {@code Extension} can be registered declaratively via
* {@link ExtendWith @ExtendWith}, programmatically via
* {@link RegisterExtension @RegisterExtension}, or automatically via
* the {@link java.util.ServiceLoader} mechanism. For details on the latter,
* consult the User Guide.
*
*
Constructor Requirements
*
* Extension implementations must have a default constructor if
* registered via {@code @ExtendWith} or the {@code ServiceLoader}. When
* registered via {@code @ExtendWith} the default constructor is not required
* to be {@code public}. When registered via the {@code ServiceLoader} the
* default constructor must be {@code public}. When registered via
* {@code @RegisterExtension} the extension's constructors typically must be
* {@code public} unless the extension provides {@code static} factory methods
* or a builder API as an alternative to constructors.
*
* @since 5.0
*/
@API(status = STABLE, since = "5.0")
public interface Extension {
}