@ -19,6 +19,8 @@ package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentatio
import java.util.Arrays ;
import java.util.List ;
import javax.sql.DataSource ;
import org.flywaydb.core.api.MigrationState ;
import org.flywaydb.core.api.MigrationType ;
import org.junit.Test ;
@ -26,11 +28,12 @@ import org.junit.Test;
import org.springframework.boot.actuate.flyway.FlywayEndpoint ;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration ;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration ;
import org.springframework.boot. test.autoconfigure.jdbc.AutoConfigureTestDatabase ;
import org.springframework.boot. jdbc.EmbeddedDatabaseConnection ;
import org.springframework.context.ApplicationContext ;
import org.springframework.context.annotation.Bean ;
import org.springframework.context.annotation.Configuration ;
import org.springframework.context.annotation.Import ;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder ;
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation ;
import org.springframework.restdocs.payload.FieldDescriptor ;
@ -44,7 +47,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
*
* @author Andy Wilkinson
* /
@AutoConfigureTestDatabase
public class FlywayEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@Test
@ -100,6 +102,13 @@ public class FlywayEndpointDocumentationTests extends MockMvcEndpointDocumentati
FlywayAutoConfiguration . class } )
static class TestConfiguration {
@Bean
public DataSource dataSource ( ) {
return new EmbeddedDatabaseBuilder ( ) . generateUniqueName ( true ) . setType (
EmbeddedDatabaseConnection . get ( getClass ( ) . getClassLoader ( ) ) . getType ( ) )
. build ( ) ;
}
@Bean
public FlywayEndpoint endpoint ( ApplicationContext context ) {
return new FlywayEndpoint ( context ) ;