package de.niklaskiefer.bncldemo.controller;

import de.niklaskiefer.bncldemo.MainApplication;

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.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

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

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = MainApplication.class)
public class MainControllerTest {

    @Autowired
    private WebApplicationContext wac;

    private MockMvc mockMvc;

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

    @Test
    public void testOpenThymeleaf() throws Exception {
        this.mockMvc.perform(get("/"))
                .andExpect(status().isOk());
    }
}

@@ -87,16 +87,64 @@
 ication;
+%0Aimport de.niklaskiefer.bncldemo.MainController;
 %0A%0Aimport
@@ -750,16 +750,104 @@
 rs.get;%0A
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;%0A
 import s
@@ -1389,16 +1389,16 @@
 t(%22/%22))%0A
-
         
@@ -1439,11 +1439,263 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testConvertBncl() throws Exception %7B%0A        String bncl = de.niklaskiefer.bnclCore.MainApplication.testBncl;%0A        this.mockMvc.perform(post(%22/convertBncl?bncl=%22 + bncl)).%0A                andExpect(status().isOk());%0A    %7D
 %0A%7D%0A

improve coverage