|  | 
| 1 | 1 | /* | 
| 2 |  | - * Copyright 2012-2017 the original author or authors. | 
|  | 2 | + * Copyright 2012-2018 the original author or authors. | 
| 3 | 3 |  * | 
| 4 | 4 |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
| 5 | 5 |  * you may not use this file except in compliance with the License. | 
|  | 
| 23 | 23 | import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration; | 
| 24 | 24 | import org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration; | 
| 25 | 25 | import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration; | 
|  | 26 | +import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration; | 
| 26 | 27 | import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; | 
| 27 | 28 | import org.springframework.context.ApplicationContext; | 
|  | 29 | +import org.springframework.core.task.AsyncTaskExecutor; | 
| 28 | 30 | import org.springframework.test.context.junit4.SpringRunner; | 
|  | 31 | +import org.springframework.test.util.ReflectionTestUtils; | 
|  | 32 | +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; | 
| 29 | 33 | 
 | 
| 30 | 34 | import static org.assertj.core.api.Assertions.assertThat; | 
| 31 | 35 | import static org.springframework.boot.test.autoconfigure.AutoConfigurationImportedCondition.importedAutoConfiguration; | 
|  | 
| 34 | 38 |  * Tests for the auto-configuration imported by {@link WebMvcTest}. | 
| 35 | 39 |  * | 
| 36 | 40 |  * @author Andy Wilkinson | 
|  | 41 | + * @author Levi Puot Paul | 
| 37 | 42 |  */ | 
| 38 | 43 | @RunWith(SpringRunner.class) | 
| 39 | 44 | @WebMvcTest | 
| @@ -66,4 +71,20 @@ public void thymeleafAutoConfigurationWasImported() { | 
| 66 | 71 | 				.has(importedAutoConfiguration(ThymeleafAutoConfiguration.class)); | 
| 67 | 72 | 	} | 
| 68 | 73 | 
 | 
|  | 74 | +	@Test | 
|  | 75 | +	public void taskExecutionAutoConfigurationWasImported() { | 
|  | 76 | +		assertThat(this.applicationContext) | 
|  | 77 | +				.has(importedAutoConfiguration(TaskExecutionAutoConfiguration.class)); | 
|  | 78 | +	} | 
|  | 79 | + | 
|  | 80 | +	@Test | 
|  | 81 | +	public void asyncTaskExecutorWithApplicationTaskExecutor() { | 
|  | 82 | +		assertThat(this.applicationContext.getBeansOfType(AsyncTaskExecutor.class)) | 
|  | 83 | +				.hasSize(1); | 
|  | 84 | +		assertThat(ReflectionTestUtils.getField( | 
|  | 85 | +				this.applicationContext.getBean(RequestMappingHandlerAdapter.class), | 
|  | 86 | +				"taskExecutor")).isSameAs( | 
|  | 87 | +						this.applicationContext.getBean("applicationTaskExecutor")); | 
|  | 88 | +	} | 
|  | 89 | + | 
| 69 | 90 | } | 
0 commit comments