use of org.apiguardian.api.API.Status.INTERNAL in project junit5 by junit-team.
the class TestIdentifier method from.
/**
* Factory for creating a new {@link TestIdentifier} from a {@link TestDescriptor}.
*/
@API(status = INTERNAL, since = "1.0")
public static TestIdentifier from(TestDescriptor testDescriptor) {
Preconditions.notNull(testDescriptor, "TestDescriptor must not be null");
String uniqueId = testDescriptor.getUniqueId().toString();
String displayName = testDescriptor.getDisplayName();
TestSource source = testDescriptor.getSource().orElse(null);
Set<TestTag> tags = testDescriptor.getTags();
Type type = testDescriptor.getType();
String parentId = testDescriptor.getParent().map(parentDescriptor -> parentDescriptor.getUniqueId().toString()).orElse(null);
String legacyReportingName = testDescriptor.getLegacyReportingName();
return new TestIdentifier(uniqueId, displayName, source, tags, type, parentId, legacyReportingName);
}
use of org.apiguardian.api.API.Status.INTERNAL in project junit5 by junit-team.
the class TestPlan method from.
/**
* Construct a new {@code TestPlan} from the supplied collection of
* {@link TestDescriptor TestDescriptors}.
*
* <p>Each supplied {@code TestDescriptor} is expected to be a descriptor
* for a {@link org.junit.platform.engine.TestEngine TestEngine}.
*
* @param engineDescriptors the engine test descriptors from which the test
* plan should be created; never {@code null}
* @return a new test plan
*/
@API(status = INTERNAL, since = "1.0")
public static TestPlan from(Collection<TestDescriptor> engineDescriptors) {
Preconditions.notNull(engineDescriptors, "Cannot create TestPlan from a null collection of TestDescriptors");
TestPlan testPlan = new TestPlan(engineDescriptors.stream().anyMatch(TestDescriptor::containsTests));
Visitor visitor = descriptor -> testPlan.add(TestIdentifier.from(descriptor));
engineDescriptors.forEach(engineDescriptor -> engineDescriptor.accept(visitor));
return testPlan;
}
Aggregations