package com.mitchellbosecke.pebble.boot.test;

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

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.boot.test.WebIntegrationTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;


@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(Application.class)
@WebIntegrationTest(randomPort=true)
public class ControllerTest {

	@Autowired
	private WebApplicationContext wac;

	protected MockMvc mockMvc;

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

	@Test
	public void testOk() throws Exception {
		mockMvc.perform(get("/index.action"))
			.andExpect(status().isOk())
			.andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_HTML))
			.andExpect(content().string("Hello Pebbleworld!"));
	}

	@Test
	public void testRequestAccess() throws Exception {
		mockMvc.perform(get("/contextPath.action"))
			.andExpect(status().isOk())
			.andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_HTML))
			.andExpect(content().string("ctx path:"));
	}

}
@@ -307,24 +307,50 @@
 .status;%0D%0A%0D%0A
+import org.junit.Assert;%0D%0A
 import org.j
@@ -784,16 +784,72 @@
 ckMvc;%0D%0A
+import org.springframework.test.web.servlet.MvcResult;%0D%0A
 import o
@@ -973,18 +973,16 @@
 ext;%0D%0A%0D%0A
-%0D%0A
 @RunWith
@@ -1096,17 +1096,19 @@
 ndomPort
-=
+ = 
 true)%0D%0Ap
@@ -1139,17 +1139,20 @@
 st %7B%0D%0A%0D%0A
-%09
+    
 @Autowir
@@ -1155,17 +1155,20 @@
 owired%0D%0A
-%09
+    
 private 
@@ -1197,17 +1197,20 @@
 wac;%0D%0A%0D%0A
-%09
+    
 protecte
@@ -1231,17 +1231,20 @@
 Mvc;%0D%0A%0D%0A
-%09
+    
 @Before%0D
@@ -1244,17 +1244,20 @@
 Before%0D%0A
-%09
+    
 public v
@@ -1271,18 +1271,24 @@
 up() %7B%0D%0A
-%09%09
+        
 this.moc
@@ -1309,21 +1309,16 @@
 Builders
-%0D%0A%09%09%09
 .webAppC
@@ -1338,21 +1338,16 @@
 his.wac)
-%0D%0A%09%09%09
 .build()
@@ -1345,39 +1345,48 @@
 ).build();%0D%0A
-%09
+    
 %7D%0D%0A%0D%0A
-%09
+    
 @Test%0D%0A
-%09
+    
 public void 
@@ -1406,34 +1406,40 @@
 ws Exception %7B%0D%0A
-%09%09
+        
 mockMvc.perform(
@@ -1451,37 +1451,32 @@
 /index.action%22))
-%0D%0A%09%09%09
 .andExpect(statu
@@ -1480,35 +1480,48 @@
 atus().isOk())%0D%0A
-%09%09%09
+                
 .andExpect(conte
@@ -1566,35 +1566,48 @@
 pe.TEXT_HTML))%0D%0A
-%09%09%09
+                
 .andExpect(conte
@@ -1647,23 +1647,32 @@
 );%0D%0A
-%09
+    
 %7D%0D%0A%0D%0A
-%09
+    
 @Test%0D%0A
-%09
+    
 publ
@@ -1719,18 +1719,43 @@
 tion %7B%0D%0A
-%09%09
+        MvcResult result = 
 mockMvc.
@@ -1789,21 +1789,16 @@
 ction%22))
-%0D%0A%09%09%09
 .andExpe
@@ -1814,27 +1814,40 @@
 ().isOk())%0D%0A
-%09%09%09
+                
 .andExpect(c
@@ -1906,58 +1906,169 @@
 ML))
-%0D%0A%09%09%09.andExpect(content().string(%22ctx path:%22
+.andReturn();%0D%0A        Assert.assertEquals(%22ctx path:%22 + result.getRequest().getContextPath(),%0D%0A                result.getResponse().getContentAsString(
 ));%0D%0A
-%09
+    
 %7D%0D%0A%0D

Fix a test that wasn't complete