org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration. 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: OghamSpringBoot2AutoConfigurationTests.java    From ogham with Apache License 2.0 6 votes vote down vote up
@Test
public void oghamInWebContext() throws Exception {
	contextRunner = contextRunner.withConfiguration(of(WebMvcAutoConfiguration.class, OghamSpringBoot2AutoConfiguration.class));
	contextRunner.run((context) -> {
		MessagingService messagingService = context.getBean(MessagingService.class);
		checkEmail(messagingService);
		checkSms(messagingService);
		OghamInternalAssertions.assertThat(messagingService)
			.sendGrid()
				.apiKey(equalTo("ogham"))
				.client(allOf(isA(SendGrid.class), not(isSpringBeanInstance(context, SendGrid.class))))
				.and()
			.thymeleaf()
				.all()
					.engine(isA(TemplateEngine.class))
					.and()
				.and()
			.freemarker()
				.all()
					.configuration()
						.defaultEncoding(equalTo(StandardCharsets.US_ASCII.name()));
	});
}
 
Example #2
Source File: OghamSpringBoot2FreeMarkerAutoConfigurationTests.java    From ogham with Apache License 2.0 5 votes vote down vote up
@Test
public void oghamWithFreemarkerAutoConfigInWebContextShouldUseSpringFreemarkerConfiguration() throws Exception {
	contextRunner = contextRunner.withConfiguration(of(WebMvcAutoConfiguration.class, FreeMarkerAutoConfiguration.class, OghamSpringBoot2AutoConfiguration.class));
	contextRunner.run((context) -> {
		MessagingService messagingService = context.getBean(MessagingService.class);
		checkEmail(messagingService);
		checkSms(messagingService);
		OghamInternalAssertions.assertThat(messagingService)
			.freemarker()
				.all()
					.configuration()
						.defaultEncoding(equalTo(StandardCharsets.UTF_16BE.name()));
	});
}
 
Example #3
Source File: OghamSpringBoot2FreeMarkerAutoConfigurationTests.java    From ogham with Apache License 2.0 5 votes vote down vote up
@Test
public void oghamWithFreemarkerAutoConfigInWebContextAndOghamPropertiesShouldUseSpringFreemarkerConfigurationAndOghamProperties() throws Exception {
	contextRunner = contextRunner.withConfiguration(of(WebMvcAutoConfiguration.class, FreeMarkerAutoConfiguration.class, OghamSpringBoot2AutoConfiguration.class))
			.withPropertyValues("ogham.freemarker.default-encoding="+StandardCharsets.US_ASCII.name());
	contextRunner.run((context) -> {
		MessagingService messagingService = context.getBean(MessagingService.class);
		checkEmail(messagingService);
		checkSms(messagingService);
		OghamInternalAssertions.assertThat(messagingService)
			.freemarker()
				.all()
					.configuration()
						.defaultEncoding(equalTo(StandardCharsets.US_ASCII.name()));
	});
}