JAVA-69: Renamed spring-security-thymeleaf to

spring-security-web-thymeleaf
This commit is contained in:
sampadawagde
2020-08-18 15:38:54 +05:30
parent 61dd35dc83
commit ec76361474
11 changed files with 2 additions and 2 deletions
@@ -0,0 +1,27 @@
package com.baeldung.springsecuritythymeleaf;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.context.WebApplicationContext;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringSecurityThymeleafApplicationIntegrationTest {
@Autowired
ViewController viewController;
@Autowired
WebApplicationContext wac;
@Test
public void whenConfigured_thenLoadsContext() {
assertNotNull(viewController);
assertNotNull(wac);
}
}
@@ -0,0 +1,27 @@
package com.baeldung.springsecuritythymeleaf;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
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.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
@RunWith(SpringRunner.class)
@WebMvcTest
public class ViewControllerIntegrationTest {
@Autowired
MockMvc mockMvc;
@Test
public void givenUser_whenPerformingGet_thenReturnsIndex() throws Exception {
mockMvc.perform(get("/index").with(user("user").password("password"))).andExpect(status().isOk()).andExpect(view().name("index"));
}
}