当前位置: 首页>>代码示例>>Java>>正文


Java Namespace类代码示例

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


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

示例1: when

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
@Test
void testInvokeDataProviderMethodToRetrieveDataShouldThrowParameterResolutionExceptionIfDataProviderInvocationThrows()
        throws Exception {
    // Given:
    Method dataProviderMethod = this.getClass().getDeclaredMethod(
            "testInvokeDataProviderMethodToRetrieveDataShouldThrowParameterResolutionExceptionIfDataProviderInvocationThrows");

    when(extensionContext.getRoot()).thenReturn(extensionContext);
    when(extensionContext.getStore(any(Namespace.class))).thenReturn(store);

    // When:
    Exception result = assertThrows(ParameterResolutionException.class,
            () -> underTest.invokeDataProviderMethodToRetrieveData(dataProviderMethod, true, extensionContext));

    // Then:
    assertThat(result).hasMessageMatching("Exception while invoking dataprovider method '.*': .*");
}
 
开发者ID:TNG,项目名称:junit-dataprovider,代码行数:18,代码来源:AbstractUseDataProviderArgumentProviderTest.java

示例2: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
private Object getMock(Parameter parameter, ExtensionContext extensionContext) {
	Class<?> mockType = parameter.getType();
	Store mocks = extensionContext.getStore(Namespace.create(MockitoExtension.class, mockType));
	String mockName = getMockName(parameter);

	if (mockName != null) {
		return mocks.getOrComputeIfAbsent(mockName, key -> mock(mockType, mockName));
	}
	else {
		return mocks.getOrComputeIfAbsent(mockType.getCanonicalName(), key -> mock(mockType));
	}
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:13,代码来源:MockitoExtension.java

示例3: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
private Object getMock(Parameter parameter,
        ExtensionContext extensionContext) {
    Class<?> mockType = parameter.getType();
    Store mocks = extensionContext
            .getStore(Namespace.create(MockitoExtension.class, mockType));
    String mockName = getMockName(parameter);

    if (mockName != null) {
        return mocks.getOrComputeIfAbsent(mockName,
                key -> mock(mockType, mockName));
    } else {
        return mocks.getOrComputeIfAbsent(mockType.getCanonicalName(),
                key -> mock(mockType));
    }
}
 
开发者ID:bonigarcia,项目名称:mastering-junit5,代码行数:16,代码来源:MockitoExtension.java

示例4: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
private Object getMock(Parameter parameter, ExtensionContext extensionContext) {
  Class<?> mockType = parameter.getType();
  Store mocks = extensionContext.getStore(Namespace.create(MockitoExtension.class, mockType));
  String mockName = getMockName(parameter);

  if (mockName != null) {
    return mocks.getOrComputeIfAbsent(mockName, key -> mock(mockType, mockName));
  } else {
    return mocks.getOrComputeIfAbsent(mockType.getCanonicalName(), key -> mock(mockType));
  }
}
 
开发者ID:1tontech,项目名称:intellij-spring-assistant,代码行数:12,代码来源:MockitoExtension.java

示例5: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
private Object getMock(Parameter parameter, ExtensionContext extensionContext) {
	Class<?> mockType = parameter.getType();
	Store mocks = extensionContext.getStore(Namespace.create(MockitoExtension.class, mockType));
	String mockName = getMockName(parameter);

	if (mockName != null) {
		return mocks.getOrComputeIfAbsent(mockName, key -> mock(mockType, mockName));
	}
	return mocks.getOrComputeIfAbsent(mockType.getCanonicalName(), key -> mock(mockType));
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:11,代码来源:MockitoExtension.java

示例6: prepare

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
@BeforeEach
public void prepare() {
  MockitoAnnotations.initMocks(this);

  when(extensionContext.getStore(Namespace.create(WatcherExtension.class, extensionContext)))
      .thenReturn(store);

  sut = new WatcherExtension(logger);
}
 
开发者ID:glytching,项目名称:junit-extensions,代码行数:10,代码来源:WatcherExtensionMetaTest.java

示例7: prepare

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
@BeforeEach
public void prepare() {
  MockitoAnnotations.initMocks(this);

  when(extensionContext.getStore(
          Namespace.create(TemporaryFolderExtension.class, extensionContext)))
      .thenReturn(store);
}
 
开发者ID:glytching,项目名称:junit-extensions,代码行数:9,代码来源:TemporaryFolderExtensionMetaTest.java

示例8: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
private Object getMock(Parameter parameter, ExtensionContext extensionContext) {
    Class<?> mockType = parameter.getType();
    Store mocks = extensionContext.getStore(Namespace.create(MockitoExtension.class, mockType));
    String mockName = getMockName(parameter);

    if (mockName != null) {
        return mocks.getOrComputeIfAbsent(mockName, key -> mock(mockType, mockName));
    }
    else {
        return mocks.getOrComputeIfAbsent(mockType.getCanonicalName(), key -> mock(mockType));
    }
}
 
开发者ID:rsky,项目名称:logbook-kai-plugins,代码行数:13,代码来源:MockitoExtension.java

示例9: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
private Object getMock(Parameter parameter, ExtensionContext extensionContext) {
    Class<?> mockType = parameter.getType();
    Store mocks = extensionContext.getStore(Namespace.create(MockitoExtension.class, mockType));
    String mockName = getMockName(parameter);

    if (mockName != null) {
        return mocks.getOrComputeIfAbsent(mockName, key -> mock(mockType, mockName));
    } else {
        return mocks.getOrComputeIfAbsent(mockType.getCanonicalName(), key -> mock(mockType));
    }
}
 
开发者ID:bkimminich,项目名称:kata-botwars,代码行数:12,代码来源:MockitoExtension.java

示例10: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
private Object getMock(final Parameter parameter, final ExtensionContext extensionContext) {
  final Class<?> mockType = parameter.getType();
  final Store mocks = extensionContext.getStore(Namespace.create(MockitoExtension.class, mockType));
  final String mockName = getMockName(parameter);

  return (mockName != null)
      ? mocks.getOrComputeIfAbsent(mockName, key -> mock(mockType, mockName))
      : mocks.getOrComputeIfAbsent(mockType.getCanonicalName(), key -> mock(mockType));
}
 
开发者ID:triplea-game,项目名称:triplea,代码行数:10,代码来源:MockitoExtension.java

示例11: getStore

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
private Store getStore(ExtensionContext context) {
    return context.getStore(Namespace.create(getClass(), context));
}
 
开发者ID:bonigarcia,项目名称:mastering-junit5,代码行数:4,代码来源:TimingExtension.java

示例12: getStore

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
private ExtensionContext.Store getStore(ExtensionContext context) {
    return context.getStore(Namespace.create("de.aliceice.paper", getClass().getName()));
}
 
开发者ID:aliceice,项目名称:paper,代码行数:4,代码来源:EnglishLocaleExtension.java

示例13: getStore

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
private Store getStore(ExtensionContext context) {
	return context.getStore(Namespace.create(context.getRequiredTestMethod()));
}
 
开发者ID:sbrannen,项目名称:junit5-demo,代码行数:4,代码来源:TimingExtension.java

示例14: localNamespace

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
private Namespace localNamespace(ExtensionContext context) {
    return Namespace.create(TempDirectoryExtension.class, context);
}
 
开发者ID:red6,项目名称:pdfcompare,代码行数:4,代码来源:TempDirectoryExtension.java

示例15: getMethodStore

import org.junit.jupiter.api.extension.ExtensionContext.Namespace; //导入依赖的package包/类
private static Store getMethodStore(ExtensionContext context) {
    Optional<Method> m = context.getTestMethod();
    if (m.isPresent()) return context.getStore(Namespace.create(DatagenUtils.class, m.get()));
    return null;
}
 
开发者ID:qala-io,项目名称:datagen,代码行数:6,代码来源:DatagenUtils.java


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