@@ -0,0 +1,2352 @@
+/*%0A * Copyright %C2%A9 2015 by Frank W. Rahn. Alle Rechte vorbehalten. All rights reserved.%0A */%0Apackage de.rahn.finances.web;%0A%0Aimport static org.hamcrest.Matchers.containsString;%0Aimport static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;%0Aimport static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.boot.test.ConfigFileApplicationContextInitializer;%0Aimport org.springframework.test.context.ContextConfiguration;%0Aimport org.springframework.test.context.junit4.SpringJUnit4ClassRunner;%0Aimport org.springframework.test.context.web.WebAppConfiguration;%0Aimport org.springframework.test.web.servlet.MockMvc;%0Aimport org.springframework.web.context.WebApplicationContext;%0A%0Aimport de.rahn.finances.SecuritiesManagementApplication;%0A%0A/**%0A * Einen Test f%C3%BCr den %7B@link ApplicationController%7D.%0A * @author Frank W. Rahn%0A */%0A@RunWith(SpringJUnit4ClassRunner.class)%0A@ContextConfiguration(classes = SecuritiesManagementApplication.class,%0A%09initializers = ConfigFileApplicationContextInitializer.class)%0A@WebAppConfiguration%0Apublic class ApplicationControllerTest %7B%0A%0A%09@Autowired%0A%09private WebApplicationContext webApplicationContext;%0A%0A%09private MockMvc mockMvc;%0A%0A%09/**%0A%09 * Initialisiere diesen Test.%0A%09 */%0A%09@Before%0A%09public void setUp() throws Exception %7B%0A%09%09mockMvc = webAppContextSetup(webApplicationContext).build();%0A%09%7D%0A%0A%09/**%0A%09 * Test method for %7B@link ApplicationController#index()%7D.%0A%09 */%0A%09@Test%0A%09public void testIndex() throws Exception %7B%0A%09%09mockMvc.perform(get(%22/%22)).andExpect(status().isOk()).andExpect(view().name(%22index%22))%0A%09%09%09.andExpect(content().string(containsString(%22Wertpapierverwaltung%22)));%0A%09%7D%0A%0A%09/**%0A%09 * Test method for %7B@link ApplicationController#info()%7D.%0A%09 */%0A%09@Test%0A%09public void testInfo() throws Exception %7B%0A%09%09mockMvc.perform(get(%22/info%22)).andExpect(status().isOk()).andExpect(view().name(%22info%22))%0A%09%09%09.andExpect(content().string(containsString(%22Management-API%22)));%0A%09%7D%0A%0A%7D%0A

Test für den ApplicationController erstellt