package com.jiayue.ssi;

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.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.context.WebApplicationContext;

/**
 * 测试基类
 *
 * @author zzy
 * @version 1.0
 * @since 2018/10/11 12:47
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = SsiApplication.class, properties = "spring.config.location=classpath:/application.yml")
@WebAppConfiguration(value = "src/main/java")
//@ContextHierarchy({ @ContextConfiguration(name = "parent", classes = { WebSecurityConfig.class}) })
//@Transactional
public abstract class BaseTest {
    @Autowired
    private WebApplicationContext wac;

    protected MockMvc mockMvc;

//    @BeforeEach
//    public void setUp() throws Exception {
//        Authentication auth = new UsernamePasswordAuthenticationToken("test", null);
//        SecurityContextHolder.getContext().setAuthentication(auth);
//        this.mockMvc = webAppContextSetup(this.wac).build();
//    }
}
