• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UniqueId类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.junit.platform.engine.UniqueId的典型用法代码示例。如果您正苦于以下问题:Java UniqueId类的具体用法?Java UniqueId怎么用?Java UniqueId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UniqueId类属于org.junit.platform.engine包,在下文中一共展示了UniqueId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: execute

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
/**
 * Instance an engine and execute the test resources identified by the given {@code selectors} and
 * wrap the response in a listener so that we can make sense of what happened. The listener
 * exposes information about the test execution flow which the extension tests can assert against.
 *
 * @param selectors {@link DiscoverySelector} instances which will isolate test class or test
 *     methods
 * @return a {@link RecordingExecutionListener} which encapsulates what the engine did
 */
public static RecordingExecutionListener execute(DiscoverySelector... selectors) {
  // instance an engine
  JupiterTestEngine testEngine = new JupiterTestEngine();

  // discover the requested test resources
  LauncherDiscoveryRequest discoveryRequest = request().selectors(selectors).build();

  RecordingExecutionListener listener = new RecordingExecutionListener();

  // execute the discovered test resources
  TestDescriptor testDescriptor =
      testEngine.discover(discoveryRequest, UniqueId.forEngine(testEngine.getId()));
  testEngine.execute(
      new ExecutionRequest(
          testDescriptor, listener, discoveryRequest.getConfigurationParameters()));

  return listener;
}
 
开发者ID:glytching,项目名称:junit-extensions,代码行数:28,代码来源:ExtensionTester.java


示例2: execute

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
public static void execute(Class<?> testClass) throws Exception {
    try {

        JupiterTestEngine engine = new JupiterTestEngine();

        TestClassEngineDiscoveryRequest discoveryRequest = new TestClassEngineDiscoveryRequest(testClass);
        TestDescriptor testDescriptor = engine.discover(discoveryRequest, UniqueId.forEngine("foo-bar"));

        EngineExecutionListener listener = new NoOpEngineExecutionListener();
        ConfigurationParameters parameters = new NoConfigurationParameters();
        engine.execute(new ExecutionRequest(testDescriptor, listener, parameters));

    } catch (UndeclaredThrowableException e) {
        Throwable cause = getFirstNonUndeclaredThrowableCause(e);
        if (cause instanceof Error) {
            throw ( Error ) cause;
        } else if (cause instanceof RuntimeException) {
            throw ( RuntimeException ) cause;
        } else if (cause instanceof Exception) {
            throw ( Exception ) cause;
        } else {
            throw e;
        }
    }
}
 
开发者ID:testIT-WebTester,项目名称:webtester2-core,代码行数:26,代码来源:TestClassExecutor.java


示例3: selectingByNamespace

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
@Test
public void selectingByNamespace() {
    EngineDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
        .selectors(selectNamespace("sample.other-test"))
        .build();
    UniqueId root = UniqueId.root("sample", "test");

    List<UniqueId> expectedIds = Stream.of(
        root.append("namespace", "sample.other-test"),
        root.append("namespace", "sample.other-test").append("name", "my-other-works"),
        root.append("namespace", "sample.other-test").append("name", "my-other-fails"),
        root.append("namespace", "sample.other-test").append("name", "my-other-error")
    ).collect(Collectors.toList());

    TestDescriptor descriptor = new ClojureTestEngine().discover(request, root);
    List<UniqueId> actualIds = descriptor.getAllDescendants().stream()
        .map(TestDescriptor::getUniqueId)
        .collect(Collectors.toList());

    assertEquals(expectedIds, actualIds);
}
 
开发者ID:ajoberstar,项目名称:jovial,代码行数:22,代码来源:ClojureTestEngineTest.java


示例4: selectingByVar

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
@Test
public void selectingByVar() {
    EngineDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
        .selectors(selectVar("sample.other-test", "my-other-works"))
        .build();
    UniqueId root = UniqueId.root("sample", "test");

    List<UniqueId> expectedIds = Stream.of(
        root.append("namespace", "sample.other-test"),
        root.append("namespace", "sample.other-test").append("name", "my-other-works")
    ).collect(Collectors.toList());

    TestDescriptor descriptor = new ClojureTestEngine().discover(request, root);
    List<UniqueId> actualIds = descriptor.getAllDescendants().stream()
        .map(TestDescriptor::getUniqueId)
        .collect(Collectors.toList());

    assertEquals(expectedIds, actualIds);
}
 
开发者ID:ajoberstar,项目名称:jovial,代码行数:20,代码来源:ClojureTestEngineTest.java


示例5: filteringByNamespace

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
@Test
public void filteringByNamespace() {
    Set<File> roots = Arrays.stream(System.getProperty("classpath.roots").split(File.pathSeparator))
        .map(File::new)
        .collect(Collectors.toSet());

    EngineDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
        .selectors(selectClasspathRoots(roots))
        .filters(includeNamespacePattern(".*other.*"))
        .build();
    UniqueId root = UniqueId.root("sample", "test");

    List<UniqueId> expectedIds = Stream.of(
        root.append("namespace", "sample.other-test"),
        root.append("namespace", "sample.other-test").append("name", "my-other-works"),
        root.append("namespace", "sample.other-test").append("name", "my-other-fails"),
        root.append("namespace", "sample.other-test").append("name", "my-other-error")
    ).collect(Collectors.toList());

    TestDescriptor descriptor = new ClojureTestEngine().discover(request, root);
    List<UniqueId> actualIds = descriptor.getAllDescendants().stream()
        .map(TestDescriptor::getUniqueId)
        .collect(Collectors.toList());

    assertEquals(expectedIds, actualIds);
}
 
开发者ID:ajoberstar,项目名称:jovial,代码行数:27,代码来源:ClojureTestEngineTest.java


示例6: getsTagsFromMetadata

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
@Test
public void getsTagsFromMetadata() {
    Set<File> roots = Arrays.stream(System.getProperty("classpath.roots").split(File.pathSeparator))
        .map(File::new)
        .collect(Collectors.toSet());

    EngineDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
        .selectors(selectClasspathRoots(roots))
        .build();
    UniqueId root = UniqueId.root("sample", "test");

    Map<UniqueId, Set<TestTag>> expectedTags = new HashMap<>();
    expectedTags.put(root.append("namespace", "sample.core-test"), tags("integration"));
    expectedTags.put(root.append("namespace", "sample.other-test"), tags());
    expectedTags.put(root.append("namespace", "sample.core-test").append("name", "my-sample-works"), tags("integration"));
    expectedTags.put(root.append("namespace", "sample.core-test").append("name", "my-sample-fails"), tags());
    expectedTags.put(root.append("namespace", "sample.other-test").append("name", "my-other-works"), tags("unit"));
    expectedTags.put(root.append("namespace", "sample.other-test").append("name", "my-other-fails"), tags());
    expectedTags.put(root.append("namespace", "sample.other-test").append("name", "my-other-error"), tags("integration"));

    TestDescriptor descriptor = new ClojureTestEngine().discover(request, root);
    Map<UniqueId, Set<TestTag>> actualTags = descriptor.getAllDescendants().stream()
        .collect(Collectors.toMap(TestDescriptor::getUniqueId, TestDescriptor::getTags));

    assertEquals(expectedTags, actualTags);
}
 
开发者ID:ajoberstar,项目名称:jovial,代码行数:27,代码来源:ClojureTestEngineTest.java


示例7: discover

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
@Override
public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest,
        UniqueId uniqueId) {
    // Discover test(s) and return a TestDescriptor object
    TestDescriptor testDescriptor = new EngineDescriptor(uniqueId,
            "My test");
    return testDescriptor;
}
 
开发者ID:bonigarcia,项目名称:mastering-junit5,代码行数:9,代码来源:MyCustomEngine.java


示例8: createDescriptor

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
private PropertyMethodDescriptor createDescriptor(String methodName, long seed, int tries, int maxDiscardRatio,
		ShrinkingMode shrinking) {
	UniqueId uniqueId = UniqueId.root("test", "i dont care");
	Method method = TestHelper.getMethod(PropertyExamples.class, methodName);
	PropertyConfiguration propertyConfig = new PropertyConfiguration("Property", seed, tries, maxDiscardRatio, shrinking, ReportingMode.MINIMAL);
	return new PropertyMethodDescriptor(uniqueId, method, PropertyExamples.class, propertyConfig);
}
 
开发者ID:jlink,项目名称:jqwik,代码行数:8,代码来源:CheckedPropertyFactoryTests.java


示例9: selectingByClasspathDir

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
@Test
public void selectingByClasspathDir() {
    Set<File> roots = Arrays.stream(System.getProperty("classpath.roots").split(File.pathSeparator))
        .map(File::new)
        .collect(Collectors.toSet());

    EngineDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
        .selectors(selectClasspathRoots(roots))
        .build();
    UniqueId root = UniqueId.root("sample", "test");

    List<UniqueId> expectedIds = Stream.of(
        root.append("namespace", "sample.core-test"),
        root.append("namespace", "sample.other-test"),
        root.append("namespace", "sample.core-test").append("name", "my-sample-works"),
        root.append("namespace", "sample.core-test").append("name", "my-sample-fails"),
        root.append("namespace", "sample.other-test").append("name", "my-other-works"),
        root.append("namespace", "sample.other-test").append("name", "my-other-fails"),
        root.append("namespace", "sample.other-test").append("name", "my-other-error")
    ).collect(Collectors.toList());

    TestDescriptor descriptor = new ClojureTestEngine().discover(request, root);
    List<UniqueId> actualIds = descriptor.getAllDescendants().stream()
        .map(TestDescriptor::getUniqueId)
        .collect(Collectors.toList());

    assertEquals(expectedIds, actualIds);
}
 
开发者ID:ajoberstar,项目名称:jovial,代码行数:29,代码来源:ClojureTestEngineTest.java


示例10: discover

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
@Override
public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) {
	this.discoveryRequestForDiscovery = discoveryRequest;
	this.uniqueIdForDiscovery = uniqueId;

	UniqueId engineUniqueId = UniqueId.forEngine(ID);
	TestDescriptorStub engineDescriptor = new TestDescriptorStub(engineUniqueId, ID);
	TestDescriptorStub testDescriptor = new TestDescriptorStub(engineUniqueId.append("test", "test"), "test");
	engineDescriptor.addChild(testDescriptor);
	return engineDescriptor;
}
 
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:12,代码来源:TestEngineSpy.java


示例11: execute

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
public static List<ExecutionEvent> execute(TestEngine testEngine, EngineDiscoveryRequest discoveryRequest) {
	TestDescriptor engineTestDescriptor = testEngine.discover(discoveryRequest,
		UniqueId.forEngine(testEngine.getId()));
	ExecutionEventRecorder listener = new ExecutionEventRecorder();
	testEngine.execute(
		new ExecutionRequest(engineTestDescriptor, listener, discoveryRequest.getConfigurationParameters()));
	return listener.getExecutionEvents();
}
 
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:9,代码来源:ExecutionEventRecorder.java


示例12: discover

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
@Override
public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) {
	TestDescriptor engine = new EngineDescriptor(uniqueId, getCaption());
	for (int i = 0; i < getScoops(discoveryRequest, 5); i++) {
		engine.addChild(new Scoop(engine.getUniqueId(), i, Flavor.random()));
	}
	return engine;
}
 
开发者ID:junit-team,项目名称:junit5-samples,代码行数:9,代码来源:Machine.java


示例13: AbstractMethodDescriptor

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
public AbstractMethodDescriptor(UniqueId uniqueId, Method targetMethod, Class containerClass) {
	super(uniqueId, determineDisplayName(targetMethod), MethodSource.from(targetMethod));
	this.containerClass = containerClass;
	this.targetMethod = targetMethod;
}
 
开发者ID:jlink,项目名称:jqwik,代码行数:6,代码来源:AbstractMethodDescriptor.java


示例14: PropertyMethodDescriptor

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
public PropertyMethodDescriptor(UniqueId uniqueId, Method propertyMethod, Class containerClass, PropertyConfiguration configuration) {
	super(uniqueId, propertyMethod, containerClass);
	this.configuration = configuration;
}
 
开发者ID:jlink,项目名称:jqwik,代码行数:5,代码来源:PropertyMethodDescriptor.java


示例15: ClojureNamespaceDescriptor

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
public ClojureNamespaceDescriptor(UniqueId id, Namespace ns) {
    super(id, ns.toString());
    this.ns = ns;
    this.tags = SimpleClojure.invoke("org.ajoberstar.jovial.lang.clojure", "tags", ns);
    setSource(SimpleClojure.invoke("org.ajoberstar.jovial.lang.clojure", "ns-source", ns));
}
 
开发者ID:ajoberstar,项目名称:jovial,代码行数:7,代码来源:ClojureNamespaceDescriptor.java


示例16: ClojureVarDescriptor

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
public ClojureVarDescriptor(UniqueId id, Var var) {
    super(id, var.sym.getName());
    this.var = var;
    this.tags = SimpleClojure.invoke("org.ajoberstar.jovial.lang.clojure", "tags", var);
    setSource(SimpleClojure.invoke("org.ajoberstar.jovial.lang.clojure", "var-source", var));
}
 
开发者ID:ajoberstar,项目名称:jovial,代码行数:7,代码来源:ClojureVarDescriptor.java


示例17: discover

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
@Override
public TestDescriptor discover(EngineDiscoveryRequest request, UniqueId uniqueId) {
    Object engine = getEngine(request.getConfigurationParameters());
    return (TestDescriptor) SimpleClojure.invoke(ENGINE_NS, "discover", engine, request, uniqueId);
}
 
开发者ID:ajoberstar,项目名称:jovial,代码行数:6,代码来源:BaseClojureEngine.java


示例18: discover

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
@Override
public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) {
	return new TestDescriptorStub(UniqueId.forEngine(getId()), getId());
}
 
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:5,代码来源:TestEngineStub.java


示例19: TestDescriptorStub

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
public TestDescriptorStub(UniqueId uniqueId, String displayName) {
	super(uniqueId, displayName);
}
 
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:4,代码来源:TestDescriptorStub.java


示例20: discoverTests

import org.junit.platform.engine.UniqueId; //导入依赖的package包/类
protected TestDescriptor discoverTests(LauncherDiscoveryRequest request) {
	return engine.discover(request, UniqueId.forEngine(engine.getId()));
}
 
开发者ID:junit-pioneer,项目名称:junit-pioneer,代码行数:4,代码来源:AbstractJupiterTestEngineTests.java



注:本文中的org.junit.platform.engine.UniqueId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StochasticLoadBalancer类代码示例发布时间:2022-05-23
下一篇:
Java EntityManagerSession类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap