// Path: hunt-common/src/main/java/com/hunt/util/SystemConstant.java
// public class SystemConstant {
//     public static final String shiro_cache_prefix = "shiro-cache-";
//     public static final String shiro_cache_prefix_keys = "shiro-cache-*";
//     public static final String github_client_id = "f4b35940357e82596645";
//     public static final String github_client_secret = "6d11170f89e0b831d20a6ccc6d10c7e99a4963b3";
//     public static final String github_oauth_url = "http://127.0.0.1:8080/oauth/github";
// 
// }


import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.WebApplicationContext;
import com.hunt.util.SystemConstant;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
package com.hunt.controller;



/**
 * @Author: ouyangan
 * @Date : 2016/10/23
 */
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration(value = "classpath:src/main/webapp")
@ContextConfiguration({"classpath:spring.xml", "classpath:spring/spring-mvc.xml"})
@Transactional
public class OauthControllerTest {

    @Autowired
    protected WebApplicationContext wac;
    protected MockMvc mockMvc;

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


    @Test
    public void github() throws Exception {
        MvcResult result = mockMvc.perform(MockMvcRequestBuilders
                .get("https://github.com/login/oauth/authorize")
                .param("client_id", SystemConstant.github_client_id)
                .param("state", "test github oauth")
// Path: hunt-common/src/main/java/com/hunt/util/SystemConstant.java
// public class SystemConstant {
//     public static final String shiro_cache_prefix = "shiro-cache-";
//     public static final String shiro_cache_prefix_keys = "shiro-cache-*";
//     public static final String github_client_id = "f4b35940357e82596645";
//     public static final String github_client_secret = "6d11170f89e0b831d20a6ccc6d10c7e99a4963b3";
//     public static final String github_oauth_url = "http://127.0.0.1:8080/oauth/github";
// 
// }


// Path: hunt-web/src/test/java/com/hunt/controller/OauthControllerTest.java
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.WebApplicationContext;
import com.hunt.util.SystemConstant;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

package com.hunt.controller;



/**
 * @Author: ouyangan
 * @Date : 2016/10/23
 */
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration(value = "classpath:src/main/webapp")
@ContextConfiguration({"classpath:spring.xml", "classpath:spring/spring-mvc.xml"})
@Transactional
public class OauthControllerTest {

    @Autowired
    protected WebApplicationContext wac;
    protected MockMvc mockMvc;

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


    @Test
    public void github() throws Exception {
        MvcResult result = mockMvc.perform(MockMvcRequestBuilders
                .get("https://github.com/login/oauth/authorize")
                .param("client_id", SystemConstant.github_client_id)
                .param("state", "test github oauth")
                .param("redirect_uri", SystemConstant.github_oauth_url)