aboutsummaryrefslogtreecommitdiffstats
path: root/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/controller/WebControllerTest.java
blob: 791194b1e2d1083e0c6376b02b35da992486c619 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.onap.sdnc.reports.controller;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;

import com.onap.sdnc.reports.Application;

@RunWith(SpringRunner.class)
@ContextConfiguration(classes=Application.class)
@WebMvcTest(WebController.class)
public class WebControllerTest {
	
	@Autowired
    private MockMvc mockMvc;

    @Test
    public void shouldReturnDefaultView() throws Exception {
        this.mockMvc.perform(get("/")).andDo(print())
        .andExpect(status().isOk())
        .andExpect(view().name("index"));
    }

}