Package org.testng.internal
Class TestMethodContainer
- java.lang.Object
-
- org.testng.internal.TestMethodContainer
-
- All Implemented Interfaces:
IContainer<ITestNGMethod>
public final class TestMethodContainer extends java.lang.Object implements IContainer<ITestNGMethod>
This implementation leverages a supplier to lazily load the test methods (data) for the very first time and "remembers it" for later invocations. If the user clears the data (the one that we were remembering) then, it resorts to just using the supplier to provide on-demand evaluation of test methods. This implementation is built such that once its been asked to forget the data, it no longer caches it anymore.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanisClearedprivate ITestNGMethod[]methodsprivate java.util.function.Supplier<ITestNGMethod[]>supplier
-
Constructor Summary
Constructors Constructor Description TestMethodContainer(java.util.function.Supplier<ITestNGMethod[]> supplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearItems()Clears the containerITestNGMethod[]getItems()booleanisCleared()
-
-
-
Field Detail
-
methods
private ITestNGMethod[] methods
-
supplier
private final java.util.function.Supplier<ITestNGMethod[]> supplier
-
isCleared
private boolean isCleared
-
-
Constructor Detail
-
TestMethodContainer
public TestMethodContainer(java.util.function.Supplier<ITestNGMethod[]> supplier)
-
-
Method Detail
-
getItems
public ITestNGMethod[] getItems()
- Specified by:
getItemsin interfaceIContainer<ITestNGMethod>- Returns:
- - Retrieves data from the container
-
isCleared
public boolean isCleared()
- Specified by:
isClearedin interfaceIContainer<ITestNGMethod>- Returns:
- -
trueif the container items were cleared.
-
clearItems
public void clearItems()
Description copied from interface:IContainerClears the container- Specified by:
clearItemsin interfaceIContainer<ITestNGMethod>
-
-