本文整理匯總了Java中org.junit.runner.Description.getClassName方法的典型用法代碼示例。如果您正苦於以下問題:Java Description.getClassName方法的具體用法?Java Description.getClassName怎麽用?Java Description.getClassName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.junit.runner.Description
的用法示例。
在下文中一共展示了Description.getClassName方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createTestResult
import org.junit.runner.Description; //導入方法依賴的package包/類
private TestResult createTestResult(final String uuid, final Description description) {
final String className = description.getClassName();
final String methodName = description.getMethodName();
final String name = Objects.nonNull(methodName) ? methodName : className;
final String fullName = Objects.nonNull(methodName) ? String.format("%s.%s", className, methodName) : className;
final String suite = Optional.ofNullable(description.getTestClass().getAnnotation(DisplayName.class))
.map(DisplayName::value).orElse(className);
final TestResult testResult = new TestResult()
.withUuid(uuid)
.withHistoryId(getHistoryId(description))
.withName(name)
.withFullName(fullName)
.withLinks(getLinks(description))
.withLabels(
new Label().withName("package").withValue(getPackage(description.getTestClass())),
new Label().withName("testClass").withValue(className),
new Label().withName("testMethod").withValue(name),
new Label().withName("suite").withValue(suite),
new Label().withName("host").withValue(getHostName()),
new Label().withName("thread").withValue(getThreadName())
);
testResult.getLabels().addAll(getLabels(description));
getDisplayName(description).ifPresent(testResult::setName);
getDescription(description).ifPresent(testResult::setDescription);
return testResult;
}
示例2: testStarted
import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public synchronized void testStarted(Description description) throws Exception {
super.testStarted(description);
String className = description.getClassName();
List<String> testDescriptions = testClassesAndTheirTests.computeIfAbsent(className, key -> new ArrayList<>());
testDescriptions.add("Method '" + description.getMethodName() + "', DisplayName: '" + description.getDisplayName() + "'" );
}
示例3: TestRequest
import org.junit.runner.Description; //導入方法依賴的package包/類
public TestRequest(Description description) {
testClass = description.getClassName();
frameworkMethod = description.getMethodName();
}
示例4: starting
import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
protected void starting(Description description) {
super.starting(description);
className = description.getClassName();
memWatcher = new MemWatcher();
}
示例5: extractNameFromDescription
import org.junit.runner.Description; //導入方法依賴的package包/類
private String extractNameFromDescription(final Description description) {
return description.getTestClass() == null ? description.getClassName() : description.getTestClass()
.getSimpleName();
}
示例6: desc
import org.junit.runner.Description; //導入方法依賴的package包/類
private String desc(Description description) {
return description.getClassName() + "." + description.getMethodName();
}