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


Java Filter.shouldRun方法代碼示例

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


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

示例1: allTestsFiltered

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
private boolean allTestsFiltered(Runner runner, List<Filter> filters) {
    LinkedList<Description> queue = new LinkedList<Description>();
    queue.add(runner.getDescription());
    while (!queue.isEmpty()) {
        Description description = queue.removeFirst();
        queue.addAll(description.getChildren());
        boolean run = true;
        for (Filter filter : filters) {
            if (!filter.shouldRun(description)) {
                run = false;
                break;
            }
        }
        if (run) {
            return false;
        }
    }
    return true;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:20,代碼來源:JUnitTestClassExecuter.java

示例2: filter

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
@Override
public void filter(final Filter raw) throws NoTestsRemainException {
	super.filter(new Filter() {
		@Override
		public boolean shouldRun(Description description) {
			String testDisplay = StringUtils.substringBefore(description.getDisplayName(), " ");
			if (testDisplay != description.getDisplayName()) {
				description = Description.createTestDescription(description.getTestClass(), testDisplay);
			}
			return raw.shouldRun(description);
		}

		@Override
		public String describe() {
			return raw.describe();
		}
	});
}
 
開發者ID:GeeQuery,項目名稱:ef-orm,代碼行數:19,代碼來源:JefJUnit4DatabaseTestRunner.java

示例3: simulateSelfRandomizingTestRun

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
/**
 * Simulates test sharding with the given filters and test descriptions, for a
 * set of test descriptions that is in a different order in every test shard.
 *
 * @param filters a list of filters, one per test shard
 * @param descriptions a list of test descriptions
 * @return a mapping from each filter to the descriptions of the tests that would be run
 *   by the shard associated with that filter.
 */
protected static Map<Filter, List<Description>> simulateSelfRandomizingTestRun(
    List<Filter> filters, List<Description> descriptions) {
  if (descriptions.isEmpty()) {
    return new HashMap<>();
  }
  Deque<Description> mutatingDescriptions = new LinkedList<>(descriptions);
  Map<Filter, List<Description>> descriptionsRun = new HashMap<>();

  for (Filter filter : filters) {
    // rotate the queue so that each filter gets the descriptions in a different order
    mutatingDescriptions.addLast(mutatingDescriptions.pollFirst());
    for (Description description : descriptions) {
      if (filter.shouldRun(description)) {
        addDescriptionForFilterToMap(descriptionsRun, filter, description);
      }
    }
  }
  return descriptionsRun;
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:29,代碼來源:ShardingFilterTestCase.java

示例4: populateDescriptionRunningMap

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
private void populateDescriptionRunningMap(Description description, Map<Description, Boolean> accumulator, Filter filter) {
    if(description.isTest()) {
        Boolean shouldRunStatus = filter.shouldRun(description);
        accumulator.put(description, shouldRunStatus);
        return;
    }
    List<Description> children = description.getChildren();
    for(Description d : children) {
        populateDescriptionRunningMap(d, accumulator, filter);
    }
}
 
開發者ID:MarkBramnik,項目名稱:rtest,代碼行數:12,代碼來源:FilterDataCreator.java

示例5: filterAppliesToAny

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
private static boolean filterAppliesToAny(Description d, Filter f) {
    if (f.shouldRun(d)) {
        return true;
    }

    for (Description c : d.getChildren()) {
        if (filterAppliesToAny(c, f)) {
            return true;
        }
    }

    return false;

}
 
開發者ID:richard-melvin,項目名稱:junit-theory-suite,代碼行數:15,代碼來源:TheorySuite.java

示例6: shouldRun

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
private boolean shouldRun(Filter filter, FrameworkMethod each) {
    if (filter.shouldRun(describeChild(each))) {
        return true;
    }

    String testDescribe = PinpointPluginTestUtils.getTestDescribe(each.getMethod());
    return testDescribe.equals(filter.describe());
}
 
開發者ID:naver,項目名稱:pinpoint,代碼行數:9,代碼來源:PinpointPluginTestRunner.java

示例7: shouldRun

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
private boolean shouldRun(Filter filter, Runner each) {
    if (filter.shouldRun(describeChild(each))) {
        return true;
    }

    if (each instanceof PinpointPluginTestRunner) {
        return ((PinpointPluginTestRunner) each).isAvaiable(filter);
    }

    return false;
}
 
開發者ID:naver,項目名稱:pinpoint,代碼行數:12,代碼來源:PinpointPluginTestSuite.java

示例8: getFilteredDescription

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
private static Description getFilteredDescription(Request request, Description description) throws NoSuchFieldException, IllegalAccessException {
  final Field field = FilterRequest.class.getDeclaredField("fFilter");
  field.setAccessible(true);
  final Filter filter = (Filter)field.get(request);
  final String filterDescription = filter.describe();
  if (filterDescription != null) {
    boolean isMethodFilter = filterDescription.startsWith("Method");
    if (isMethodFilter && canCompress(description)) return (Description)description.getChildren().get(0);
    try {
      final Description failedTestsDescription = Description.createSuiteDescription(filterDescription, null);
      if (filterDescription.startsWith("Tests") || filterDescription.startsWith("Ignored")) {
        for (Iterator iterator = description.getChildren().iterator(); iterator.hasNext(); ) {
          final Description childDescription = (Description)iterator.next();
          if (filter.shouldRun(childDescription)) {
            failedTestsDescription.addChild(childDescription);
          }
        }
        description = failedTestsDescription;
      } else  if (isMethodFilter && canCompress(failedTestsDescription)) {
        description = (Description)failedTestsDescription.getChildren().get(0);
      }
    }
    catch (NoSuchMethodError e) {
      //junit 4.0 doesn't have method createSuite(String, Annotation...) : skip it
    }
  }
  return description;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:29,代碼來源:JUnit4IdeaTestRunner.java

示例9: simulateTestRun

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
/**
 * Simulates test sharding with the given filters and test descriptions.
 *
 * @param filters a list of filters, one per test shard
 * @param descriptions a list of test descriptions
 * @return a mapping from each filter to the descriptions of the tests that would be run
 *   by the shard associated with that filter.
 */
protected static Map<Filter, List<Description>> simulateTestRun(List<Filter> filters,
    List<Description> descriptions) {
  Map<Filter, List<Description>> descriptionsRun = new HashMap<>();
  for (Filter filter : filters) {
    for (Description description : descriptions) {
      if (filter.shouldRun(description)) {
        addDescriptionForFilterToMap(descriptionsRun, filter, description);
      }
    }
  }
  return descriptionsRun;
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:21,代碼來源:ShardingFilterTestCase.java

示例10: shouldRun

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
private boolean shouldRun(Filter filter, FrameworkMethod each) {
    return filter.shouldRun(describeOriginalChild(each));
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:4,代碼來源:LoadTimeWeavableTestRunner.java

示例11: shouldRun

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
private boolean shouldRun(Filter filter, T each) {
	return filter.shouldRun(describeChild(each));
}
 
開發者ID:Sellegit,項目名稱:j2objc,代碼行數:4,代碼來源:ParentRunner.java

示例12: shouldRun

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
private boolean shouldRun(Filter filter, T each) {
    return filter.shouldRun(describeChild(each));
}
 
開發者ID:DIVERSIFY-project,項目名稱:sosiefier,代碼行數:4,代碼來源:ParentRunner.java

示例13: assertThrowsExceptionForUnknownDescription

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
protected static void assertThrowsExceptionForUnknownDescription(Filter filter) {
  try {
    filter.shouldRun(Description.createTestDescription(Object.class, "unknown"));
    fail("expected thrown exception");
  } catch (IllegalArgumentException expected) { }
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:7,代碼來源:ShardingFilterTestCase.java

示例14: shouldRun

import org.junit.runner.manipulation.Filter; //導入方法依賴的package包/類
private boolean shouldRun(Filter filter, FrameworkMethod each) {
    return filter.shouldRun(describeChild(each));
}
 
開發者ID:gnu-user,項目名稱:orwell,代碼行數:4,代碼來源:Corollaries.java


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