org.springframework.boot.test.context.runner.ContextConsumer Java Examples
The following examples show how to use
org.springframework.boot.test.context.runner.ContextConsumer.
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: TraceHttpAutoConfigurationTests.java From spring-cloud-sleuth with Apache License 2.0 | 5 votes |
private ContextConsumer<AssertableApplicationContext> thenCompositeHttpServerSamplerOf( SamplerFunction<HttpRequest> instance) { return (context) -> { SamplerFunction<HttpRequest> serverSampler = context .getBean(HttpTracing.class).serverRequestSampler(); then(serverSampler).isInstanceOf(CompositeHttpSampler.class); then(((CompositeHttpSampler) serverSampler).left) .isInstanceOf(SkipPatternHttpServerSampler.class); then(((CompositeHttpSampler) serverSampler).right).isSameAs(instance); }; }
Example #2
Source File: ProjectAssetTester.java From initializr with Apache License 2.0 | 5 votes |
/** * Configure a {@link ProjectGenerationContext} using the specified * {@code description} and use the {@link ContextConsumer} to assert the context. * @param description the description of the project to configure * @param consumer the consumer of the created {@link ProjectGenerationContext} * @see ApplicationContextRunner#run(ContextConsumer) */ public void configure(MutableProjectDescription description, ContextConsumer<AssertableApplicationContext> consumer) { invokeProjectGeneration(description, (contextInitializer) -> { new ApplicationContextRunner(ProjectGenerationContext::new).withInitializer((ctx) -> { ProjectGenerationContext projectGenerationContext = (ProjectGenerationContext) ctx; projectGenerationContext.registerBean(ProjectDescription.class, () -> description); contextInitializer.accept(projectGenerationContext); }).run(consumer); return null; }); }
Example #3
Source File: HazelcastJetAutoConfigurationClientTests.java From hazelcast-jet-contrib with Apache License 2.0 | 4 votes |
private static ContextConsumer<AssertableApplicationContext> assertSpecificHazelcastJetClient(String label) { return (context) -> assertThat(context).getBean(JetInstance.class).isInstanceOf(JetInstance.class) .has(labelEqualTo(label)); }
Example #4
Source File: HazelcastJetAutoConfigurationServerTests.java From hazelcast-jet-contrib with Apache License 2.0 | 4 votes |
private static ContextConsumer<AssertableApplicationContext> assertSpecificJetServer(String suffix) { return context -> { JetConfig jetConfig = context.getBean(JetInstance.class).getConfig(); assertThat(jetConfig.getProperties().getProperty("foo")).isEqualTo("bar-" + suffix); }; }
Example #5
Source File: HazelcastJetAutoConfigurationServerTests.java From hazelcast-jet-contrib with Apache License 2.0 | 4 votes |
private static ContextConsumer<AssertableApplicationContext> assertSpecificJetImdgServer(String clusterName) { return context -> { JetConfig jetConfig = context.getBean(JetInstance.class).getConfig(); assertThat(jetConfig.getHazelcastConfig().getClusterName()).isEqualTo(clusterName); }; }
Example #6
Source File: GcpContextAutoConfigurationTests.java From spring-cloud-gcp with Apache License 2.0 | 4 votes |
private ContextConsumer<AssertableApplicationContext> checkNumberOfBeansOfTypeGcpProjectIdProvider(int count) { return context -> assertThat(context .getBeansOfType(GcpProjectIdProvider.class).size()) .isEqualTo(count); }