All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.junitpioneer.jupiter.resource.Resource Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2016-2023 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.junitpioneer.jupiter.resource;

import org.junit.jupiter.api.extension.ExtensionContext;

/**
 * {@code Resource} is the common interface for "resources", as managed by {@link ResourceFactory}
 * implementations.
 *
 * 

It is part of the "resources" JUnit Jupiter extension, which pertains to anything that needs * to be injected into tests and which may need to be started up or torn down. Temporary * directories are a common example. * *

This class is intended for implementors of new kinds of resources.

* *

For more details and examples, see * the documentation on resources.

* * @param the type of the resource * @since 1.9.0 * @see ResourceFactory */ public interface Resource extends ExtensionContext.Store.CloseableResource { /** * Returns the contents of the resource. * * @throws Exception if getting the resource failed */ T get() throws Exception; /** * Closes the resource. * * @throws Exception if closing the resource failed */ @Override default void close() throws Exception { // no op by default } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy