formatting work

This commit is contained in:
eugenp
2016-10-12 08:02:05 +03:00
parent eb7650eead
commit 856be0a08a
128 changed files with 2039 additions and 2275 deletions

View File

@@ -17,13 +17,12 @@ public class MainController {
@Autowired
private ITutorialsService tutService;
@RequestMapping(value ="/", method = RequestMethod.GET)
@RequestMapping(value = "/", method = RequestMethod.GET)
public String welcomePage() {
return "index";
return "index";
}
@RequestMapping(value ="/list", method = RequestMethod.GET)
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String listTutorialsPage(Model model) {
List<Tutorial> list = tutService.listTutorials();
model.addAttribute("tutorials", list);
@@ -37,6 +36,5 @@ public class MainController {
public void setTutService(ITutorialsService tutService) {
this.tutService = tutService;
}
}

View File

@@ -6,5 +6,5 @@ import java.util.List;
public interface ITutorialsService {
List<Tutorial> listTutorials();
List<Tutorial> listTutorials();
}

View File

@@ -10,9 +10,6 @@ import java.util.List;
public class TutorialsService implements ITutorialsService {
public List<Tutorial> listTutorials() {
return Arrays.asList(
new Tutorial(1, "Guava", "Introduction to Guava", "GuavaAuthor"),
new Tutorial(2, "Android", "Introduction to Android", "AndroidAuthor")
);
return Arrays.asList(new Tutorial(1, "Guava", "Introduction to Guava", "GuavaAuthor"), new Tutorial(2, "Android", "Introduction to Android", "AndroidAuthor"));
}
}

View File

@@ -13,7 +13,7 @@ import org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver;
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = { "com.baeldung.mvc.velocity.controller", "com.baeldung.mvc.velocity.service"})
@ComponentScan(basePackages = { "com.baeldung.mvc.velocity.controller", "com.baeldung.mvc.velocity.service" })
public class WebConfig extends WebMvcConfigurerAdapter {
@Override

View File

@@ -38,7 +38,6 @@ public class DataContentControllerTest {
@Before
public void setUp() {
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
}
@@ -53,9 +52,9 @@ public class DataContentControllerTest {
mockMvc.perform(get("/list")).andExpect(xpath("//table").exists());
mockMvc.perform(get("/list")).andExpect(xpath("//td[@id='tutId_1']").exists());
}
@Test
public void whenCallingIndex_thenViewOK() throws Exception{
public void whenCallingIndex_thenViewOK() throws Exception {
mockMvc.perform(get("/")).andExpect(status().isOk()).andExpect(view().name("index")).andExpect(model().size(0));
}
}

View File

@@ -8,7 +8,6 @@ import org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver;
@Configuration
public class TestConfig {
@Bean
public ViewResolver viewResolver() {
@@ -19,14 +18,12 @@ public class TestConfig {
bean.setSuffix(".vm");
return bean;
}
@Bean
public VelocityConfigurer velocityConfig() {
VelocityConfigurer velocityConfigurer = new VelocityConfigurer();
velocityConfigurer.setResourceLoaderPath("/");
return velocityConfigurer;
}
}