當前位置: 首頁>>代碼示例>>Java>>正文


Java Description.isTest方法代碼示例

本文整理匯總了Java中org.junit.runner.Description.isTest方法的典型用法代碼示例。如果您正苦於以下問題:Java Description.isTest方法的具體用法?Java Description.isTest怎麽用?Java Description.isTest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.junit.runner.Description的用法示例。


在下文中一共展示了Description.isTest方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: test

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public boolean test(Object receiver, String property, Object[] args,
		Object expectedValue) {

	if (receiver instanceof IStructuredSelection == false) {
		return false;
	}

	Object element = ((IStructuredSelection) receiver).getFirstElement();

	if (element == null || element instanceof Description == false) {
		return false;
	}

	Description description = (Description) element;

	if (property.equals("isTest")) {
		return description.isTest();
	}

	if (property.equals("isSuite")) {
		return description.isSuite();
	}

	return false;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:27,代碼來源:DescriptionTester.java

示例2: getTestName

import org.junit.runner.Description; //導入方法依賴的package包/類
/***/
public static String getTestName(Description description) {
	String text = null;
	if (description.isTest()) {
		String s = description.getDisplayName();

		if (s.startsWith(TEST_FILE_INIT_ERROR_MSG)) {
			return TEST_FILE_INIT_ERROR_MSG;
		}

		// seems like malformed xt file - no XPECT comment ?
		if (s.indexOf("#") < 0 || s.indexOf("~") < 0) {
			return s;
		}

		int posXT = s.indexOf("#");
		int posTM = s.indexOf("~", posXT);
		text = s.substring(posXT + 1, posTM);
	}
	return text;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:22,代碼來源:N4IDEXpectFileNameUtil.java

示例3: execute

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

	IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);

	IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
	try {
		view = (N4IDEXpectView) windows[0].getActivePage().showView(
				N4IDEXpectView.ID);
	} catch (PartInitException e) {
		N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
	}

	Description desc = (Description) selection.getFirstElement();
	if (desc.isTest() && view.testsExecutionStatus.hasFailed(desc)) {
		Throwable failureException = view.testsExecutionStatus.getFailure(desc).getException();

		if (failureException instanceof ComparisonFailure) {
			ComparisonFailure cf = (ComparisonFailure) failureException;
			// display comparison view
			displayComparisonView(cf, desc);
		}
	}
	return null;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:26,代碼來源:XpectCompareCommandHandler.java

示例4: getText

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public String getText(Object element) {

	if (element instanceof Description == false) {
		return "";
	}

	Description desc = ((Description) element);

	if (desc.isSuite()) {
		return N4IDEXpectFileNameUtil.getSuiteName(desc);
	}

	if (desc.isTest()) {
		return N4IDEXpectFileNameUtil.getTestName(desc);
	}

	return "";
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:20,代碼來源:XpectLabelProvider.java

示例5: getImageDescriptor

import org.junit.runner.Description; //導入方法依賴的package包/類
/**
 * get icon based on item type (test/suite) and its status (pass/failed/exception/skip/in progress...)
 */
private ImageDescriptor getImageDescriptor(Object element) throws RuntimeException {
	ImageDescriptor descriptor = null;
	if (element instanceof Description == false) {
		String msg = "Unknown type of element in tree of type " + element.getClass().getName();
		Exception e = new RuntimeException(msg);
		N4IDEXpectUIPlugin.logError("cannot obtain image descriptor, fallback to default", e);
		return getImageDescriptor("n4_logo.png");
	}

	Description desc = (Description) element;

	if (desc.isTest()) {
		descriptor = getTestImageDescriptor(executionStatus.getStatus(desc));
	} else if (desc.isSuite()) {
		descriptor = getSuiteImageDescriptor(desc, executionStatus.getStatus(desc));
	} else {
		descriptor = getImageDescriptor("n4_logo.png");
	}
	return descriptor;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:24,代碼來源:XpectLabelProvider.java

示例6: apply

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public Statement apply(final Statement base, final Description description) {

	return new Statement() {

		@Override
		public void evaluate() throws Throwable {

			if (description.isTest()) {
				if (RequiresRedisSentinel.this.requiredSentinels != null) {
					verify(RequiresRedisSentinel.this.requiredSentinels);
				}

			} else {
				verify(RequiresRedisSentinel.this.requiredSentinels);
			}

			base.evaluate();
		}
	};
}
 
開發者ID:Just-Fun,項目名稱:spring-data-examples,代碼行數:22,代碼來源:RequiresRedisSentinel.java

示例7: shouldRun

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public boolean shouldRun(final Description description) {
    if (description.isTest()) {
        return delegate.shouldRun(description);
    }

    // explicitly check if any children want to run
    for (Description child : description.getChildren()) {
        if (shouldRun(child)) {
            return true;
        }
        //Intellij bug, we get the wrong description, let us test with a slightly modified one now
        final Description relaxed = Description.createTestDescription(
                child.getTestClass(), getMethodName(child.getDisplayName())
        );
        if (shouldRun(relaxed)) {
            return true;
        }
    }
    return false;
}
 
開發者ID:tools4j,項目名稱:spockito,代碼行數:22,代碼來源:MethodLevelFilter.java

示例8: startFakeTestCase

import org.junit.runner.Description; //導入方法依賴的package包/類
public void startFakeTestCase(Description description) {
    String uid = getSuiteUid(description);

    String name = description.isTest() ? getTestName() : getSuiteName(description);
    TestCaseStartedEvent event = new TestCaseStartedEvent(uid, name);
    AnnotationManager am = new AnnotationManager(description.getAnnotations());
    am.update(event);

    fireClearStepStorage();
    getLifecycle().fire(event);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:12,代碼來源:AllureMarathonRunListener.java

示例9: apply

import org.junit.runner.Description; //導入方法依賴的package包/類
@Override
public Statement apply(final Statement base, final Description description) {
  if (description.isTest()) {
    return statement(base);
  } else if (description.isSuite()) {
    return statementClass(base);
  }
  return base;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:10,代碼來源:RuleAndClassRuleTest.java

示例10: isTest

import org.junit.runner.Description; //導入方法依賴的package包/類
protected boolean isTest(final Description description) {
  return (description.isSuite() || description.isTest());
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:4,代碼來源:IgnoreUntilRule.java

示例11: isTest

import org.junit.runner.Description; //導入方法依賴的package包/類
private boolean isTest(final Description description) {
  return (description.isSuite() || description.isTest());
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:4,代碼來源:RetryRule.java


注:本文中的org.junit.runner.Description.isTest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。