package uk.ac.ebi.spot.goci.curation.controller;


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.SpringApplicationConfiguration;
import org.springframework.http.MediaType;
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.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import uk.ac.ebi.spot.goci.CurationApplication;

import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

/**
 * Created by emma on 14/10/2015.
 *
 * @author emma
 *         <p>
 *         Unit test for HomeController based on http://spring.io/guides/gs/spring-boot/
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = CurationApplication.class)
@WebAppConfiguration
public class HomeControllerTest {

    @Autowired
    private HomeController homeController;

    private MockMvc mvc;

    @Before
    public void setUp() throws Exception {
        mvc = MockMvcBuilders.standaloneSetup(homeController).build();
    }

    @Test
    public void getHome() throws Exception {
        mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.TEXT_HTML_VALUE))
                .andExpect(status().isOk());
    }
}


@@ -682,16 +682,111 @@
 ation;%0A%0A
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl;%0A
 import s
@@ -1598,11 +1598,75 @@
 ).is
-Ok(
+3xxRedirection())%0A                .andExpect(redirectedUrl(%22/login%22
 ));%0A

Update to reflect redirect