| 1 | /* |
| 2 | * Copyright 2015-2024 the original author or authors. |
| 3 | * |
| 4 | * All rights reserved. This program and the accompanying materials are |
| 5 | * made available under the terms of the Eclipse Public License v2.0 which |
| 6 | * accompanies this distribution and is available at |
| 7 | * |
| 8 | * https://www.eclipse.org/legal/epl-v20.html |
| 9 | */ |
| 10 | |
| 11 | package org.junit.jupiter.api; |
| 12 | |
| 13 | import static org.apiguardian.api.API.Status.STABLE; |
| 14 | |
| 15 | import java.util.List; |
| 16 | import java.util.Optional; |
| 17 | |
| 18 | import org.apiguardian.api.API; |
| 19 | |
| 20 | /** |
| 21 | * {@code MethodOrdererContext} encapsulates the <em>context</em> in which |
| 22 | * a {@link MethodOrderer} will be invoked. |
| 23 | * |
| 24 | * @since 5.4 |
| 25 | * @see MethodOrderer |
| 26 | * @see MethodDescriptor |
| 27 | */ |
| 28 | @API(status = STABLE, since = "5.7") |
| 29 | public interface MethodOrdererContext { |
| 30 | |
| 31 | /** |
| 32 | * Get the test class for this context. |
| 33 | * |
| 34 | * @return the test class; never {@code null} |
| 35 | */ |
| 36 | Class<?> getTestClass(); |
| 37 | |
| 38 | /** |
| 39 | * Get the list of {@linkplain MethodDescriptor method descriptors} to |
| 40 | * order. |
| 41 | * |
| 42 | * @return the list of method descriptors; never {@code null} |
| 43 | */ |
| 44 | List<? extends MethodDescriptor> getMethodDescriptors(); |
| 45 | |
| 46 | /** |
| 47 | * Get the configuration parameter stored under the specified {@code key}. |
| 48 | * |
| 49 | * <p>If no such key is present in the {@code ConfigurationParameters} for |
| 50 | * the JUnit Platform, an attempt will be made to look up the value as a |
| 51 | * JVM system property. If no such system property exists, an attempt will |
| 52 | * be made to look up the value in the JUnit Platform properties file. |
| 53 | * |
| 54 | * @param key the key to look up; never {@code null} or blank |
| 55 | * @return an {@code Optional} containing the value; never {@code null} |
| 56 | * but potentially empty |
| 57 | * |
| 58 | * @see System#getProperty(String) |
| 59 | * @see org.junit.platform.engine.ConfigurationParameters |
| 60 | */ |
| 61 | Optional<String> getConfigurationParameter(String key); |
| 62 | |
| 63 | } |