org.springframework.test.context.ContextCustomizerFactory Java Examples
The following examples show how to use
org.springframework.test.context.ContextCustomizerFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractTestContextBootstrapper.java From spring-analysis-note with MIT License | 5 votes |
private Set<ContextCustomizer> getContextCustomizers(Class<?> testClass, List<ContextConfigurationAttributes> configAttributes) { List<ContextCustomizerFactory> factories = getContextCustomizerFactories(); Set<ContextCustomizer> customizers = new LinkedHashSet<>(factories.size()); for (ContextCustomizerFactory factory : factories) { ContextCustomizer customizer = factory.createContextCustomizer(testClass, configAttributes); if (customizer != null) { customizers.add(customizer); } } return customizers; }
Example #2
Source File: ContextCustomizerSpringRunnerTests.java From spring-analysis-note with MIT License | 5 votes |
@Override protected List<ContextCustomizerFactory> getContextCustomizerFactories() { return singletonList( (ContextCustomizerFactory) (testClass, configAttributes) -> (ContextCustomizer) (context, mergedConfig) -> context.getBeanFactory().registerSingleton("foo", "foo") ); }
Example #3
Source File: AbstractTestContextBootstrapper.java From java-technology-stack with MIT License | 5 votes |
private Set<ContextCustomizer> getContextCustomizers(Class<?> testClass, List<ContextConfigurationAttributes> configAttributes) { List<ContextCustomizerFactory> factories = getContextCustomizerFactories(); Set<ContextCustomizer> customizers = new LinkedHashSet<>(factories.size()); for (ContextCustomizerFactory factory : factories) { ContextCustomizer customizer = factory.createContextCustomizer(testClass, configAttributes); if (customizer != null) { customizers.add(customizer); } } return customizers; }
Example #4
Source File: ContextCustomizerSpringRunnerTests.java From java-technology-stack with MIT License | 5 votes |
@Override protected List<ContextCustomizerFactory> getContextCustomizerFactories() { return singletonList( (ContextCustomizerFactory) (testClass, configAttributes) -> (ContextCustomizer) (context, mergedConfig) -> context.getBeanFactory().registerSingleton("foo", "foo") ); }
Example #5
Source File: BootstrapWithTestInterface.java From spring-analysis-note with MIT License | 4 votes |
@Override protected List<ContextCustomizerFactory> getContextCustomizerFactories() { return singletonList( (ContextCustomizerFactory) (testClass, configAttributes) -> (ContextCustomizer) (context, mergedConfig) -> context.getBeanFactory().registerSingleton("foo", "foo")); }
Example #6
Source File: BootstrapWithTestInterface.java From java-technology-stack with MIT License | 4 votes |
@Override protected List<ContextCustomizerFactory> getContextCustomizerFactories() { return singletonList( (ContextCustomizerFactory) (testClass, configAttributes) -> (ContextCustomizer) (context, mergedConfig) -> context.getBeanFactory().registerSingleton("foo", "foo")); }
Example #7
Source File: AbstractTestContextBootstrapper.java From spring-analysis-note with MIT License | 2 votes |
/** * Get the {@link ContextCustomizerFactory} instances for this bootstrapper. * <p>The default implementation uses the {@link SpringFactoriesLoader} mechanism * for loading factories configured in all {@code META-INF/spring.factories} * files on the classpath. * @since 4.3 * @see SpringFactoriesLoader#loadFactories */ protected List<ContextCustomizerFactory> getContextCustomizerFactories() { return SpringFactoriesLoader.loadFactories(ContextCustomizerFactory.class, getClass().getClassLoader()); }
Example #8
Source File: AbstractTestContextBootstrapper.java From java-technology-stack with MIT License | 2 votes |
/** * Get the {@link ContextCustomizerFactory} instances for this bootstrapper. * <p>The default implementation uses the {@link SpringFactoriesLoader} mechanism * for loading factories configured in all {@code META-INF/spring.factories} * files on the classpath. * @since 4.3 * @see SpringFactoriesLoader#loadFactories */ protected List<ContextCustomizerFactory> getContextCustomizerFactories() { return SpringFactoriesLoader.loadFactories(ContextCustomizerFactory.class, getClass().getClassLoader()); }