// Path: src/main/java/com/edwise/completespring/Application.java
// @Slf4j
// @SpringBootApplication
// public class Application {
// 
//     @Autowired
//     private DataLoader dataLoader;
// 
//     public static void main(String[] args) {
//         SpringApplication.run(Application.class, args);
//     }
// 
//     @Bean
//     CommandLineRunner init(@Value("${db.resetAndLoadOnStartup:true}") boolean resetAndLoadDBDataOnStartup) {
//         return args -> initApp(resetAndLoadDBDataOnStartup);
//     }
// 
//     void initApp(boolean restAndLoadDBData) {
//         log.info("Init Application...");
//         if (restAndLoadDBData) {
//             dataLoader.fillDBData();
//         }
//         log.info("Aplication initiated!");
//     }
// 
// }
// 
// Path: src/main/java/com/edwise/completespring/config/SwaggerConfig.java
// @Configuration
// @EnableSwagger2
// public class SwaggerConfig {
//     public static final String BOOKS_API_GROUP = "books-api";
// 
//     @Bean
//     public Docket newsApi() {
//         return new Docket(DocumentationType.SWAGGER_2)
//                 .groupName(BOOKS_API_GROUP)
//                 .apiInfo(apiInfo())
//                 .directModelSubstitute(LocalDate.class, String.class)
//                 .select()
//                 .paths(regex("/api.*"))
//                 .build();
//     }
// 
//     private ApiInfo apiInfo() {
//         return new ApiInfoBuilder()
//                 .title("Books API")
//                 .description("Your book database!")
//                 .termsOfServiceUrl("http://en.wikipedia.org/wiki/Terms_of_service")
//                 .contact(new Contact("edwise", "https://github.com/edwise", "edwise.null@gmail.com"))
//                 .license("Apache License Version 2.0")
//                 .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
//                 .version("2.0")
//                 .build();
//     }
// }


import com.edwise.completespring.Application;
import com.edwise.completespring.config.SwaggerConfig;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import static org.hamcrest.Matchers.is;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
package com.edwise.completespring.testswagger;



@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class ITCommonSwaggerAPITest {

    private MockMvc mockMvc;

    @Autowired
    protected WebApplicationContext webApplicationContext;

    @Before
    public void setUp() {
        mockMvc = MockMvcBuilders.webAppContextSetup(this.webApplicationContext).build();
    }

    @Test
    public void getApiDocsSwagger_shouldReturnGeneralInfoOfAPI() throws Exception {
// Path: src/main/java/com/edwise/completespring/Application.java
// @Slf4j
// @SpringBootApplication
// public class Application {
// 
//     @Autowired
//     private DataLoader dataLoader;
// 
//     public static void main(String[] args) {
//         SpringApplication.run(Application.class, args);
//     }
// 
//     @Bean
//     CommandLineRunner init(@Value("${db.resetAndLoadOnStartup:true}") boolean resetAndLoadDBDataOnStartup) {
//         return args -> initApp(resetAndLoadDBDataOnStartup);
//     }
// 
//     void initApp(boolean restAndLoadDBData) {
//         log.info("Init Application...");
//         if (restAndLoadDBData) {
//             dataLoader.fillDBData();
//         }
//         log.info("Aplication initiated!");
//     }
// 
// }
// 
// Path: src/main/java/com/edwise/completespring/config/SwaggerConfig.java
// @Configuration
// @EnableSwagger2
// public class SwaggerConfig {
//     public static final String BOOKS_API_GROUP = "books-api";
// 
//     @Bean
//     public Docket newsApi() {
//         return new Docket(DocumentationType.SWAGGER_2)
//                 .groupName(BOOKS_API_GROUP)
//                 .apiInfo(apiInfo())
//                 .directModelSubstitute(LocalDate.class, String.class)
//                 .select()
//                 .paths(regex("/api.*"))
//                 .build();
//     }
// 
//     private ApiInfo apiInfo() {
//         return new ApiInfoBuilder()
//                 .title("Books API")
//                 .description("Your book database!")
//                 .termsOfServiceUrl("http://en.wikipedia.org/wiki/Terms_of_service")
//                 .contact(new Contact("edwise", "https://github.com/edwise", "edwise.null@gmail.com"))
//                 .license("Apache License Version 2.0")
//                 .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
//                 .version("2.0")
//                 .build();
//     }
// }


// Path: src/integration-test/java/com/edwise/completespring/testswagger/ITCommonSwaggerAPITest.java
import com.edwise.completespring.Application;
import com.edwise.completespring.config.SwaggerConfig;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import static org.hamcrest.Matchers.is;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

package com.edwise.completespring.testswagger;



@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class ITCommonSwaggerAPITest {

    private MockMvc mockMvc;

    @Autowired
    protected WebApplicationContext webApplicationContext;

    @Before
    public void setUp() {
        mockMvc = MockMvcBuilders.webAppContextSetup(this.webApplicationContext).build();
    }

    @Test
    public void getApiDocsSwagger_shouldReturnGeneralInfoOfAPI() throws Exception {
        mockMvc.perform(get("/v2/api-docs").param("group", SwaggerConfig.BOOKS_API_GROUP))