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


Java Store.getOrComputeIfAbsent方法代码示例

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


在下文中一共展示了Store.getOrComputeIfAbsent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Store; //导入方法依赖的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

示例2: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Store; //导入方法依赖的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

示例3: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Store; //导入方法依赖的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

示例4: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Store; //导入方法依赖的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

示例5: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Store; //导入方法依赖的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

示例6: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Store; //导入方法依赖的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

示例7: getMock

import org.junit.jupiter.api.extension.ExtensionContext.Store; //导入方法依赖的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

示例8: getTestContextManager

import org.junit.jupiter.api.extension.ExtensionContext.Store; //导入方法依赖的package包/类
/**
 * Get the {@link TestContextManager} associated with the supplied {@code ExtensionContext}.
 * @return the {@code TestContextManager} (never {@code null})
 */
private static TestContextManager getTestContextManager(ExtensionContext context) {
	Assert.notNull(context, "ExtensionContext must not be null");
	Class<?> testClass = context.getRequiredTestClass();
	Store store = getStore(context);
	return store.getOrComputeIfAbsent(testClass, TestContextManager::new, TestContextManager.class);
}
 
开发者ID:sbrannen,项目名称:spring-test-junit5,代码行数:11,代码来源:SpringExtension.java


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