Package org.springframework.test.web

Examples of org.springframework.test.web.Person


  @Controller
  private static class PersonController {

    @RequestMapping(value="/person/{name}", method=RequestMethod.GET)
    public String show(@PathVariable String name, Model model) {
      Person person = new Person(name);
      model.addAttribute(person);
      return "person/show";
    }
View Full Code Here


  private class PersonController {

    @RequestMapping(value="/person/{name}")
    @ResponseBody
    public Person get(@PathVariable String name) {
      Person person = new Person(name);
      return person;
    }
View Full Code Here

  public void getPerson() throws Exception {
    this.mockMvc.perform(get("/persons/Joe").flashAttr("message", "success!"))
      .andExpect(status().isOk())
            .andExpect(forwardedUrl("persons/index"))
            .andExpect(model().size(2))
            .andExpect(model().attribute("person", new Person("Joe")))
            .andExpect(model().attribute("message", "success!"))
            .andExpect(flash().attributeCount(0));
  }
View Full Code Here

  @Controller
  private static class PersonController {

    @RequestMapping(value="/persons/{name}", method=RequestMethod.GET)
    public String getPerson(@PathVariable String name, Model model) {
      model.addAttribute(new Person(name));
      return "persons/index";
    }
View Full Code Here

  private class PersonController {

    @RequestMapping(value="/search")
    @ResponseBody
    public Person get(@RequestParam String name) {
      Person person = new Person(name);
      return person;
    }
View Full Code Here

    @ResponseBody
    public Person showEntity(@PathVariable long id, WebRequest request) {
      if (request.checkNotModified(calculateLastModified(id))) {
        return null;
      }
      return new Person("Jason");
    }
View Full Code Here

  private MockMvc mockMvc;

  @Before
  public void setup() {

    SampleController controller = new SampleController("a string value", 3, new Person("a name"));

    this.mockMvc = standaloneSetup(controller)
        .defaultRequest(get("/"))
        .alwaysExpect(status().isOk())
        .build();
View Full Code Here

    @RequestMapping(value="/music/people")
    public @ResponseBody PeopleWrapper getPeople() {

      List<Person> composers = Arrays.asList(
          new Person("Johann Sebastian Bach").setSomeDouble(21),
          new Person("Johannes Brahms").setSomeDouble(.0025),
          new Person("Edvard Grieg").setSomeDouble(1.6035),
          new Person("Robert Schumann").setSomeDouble(Double.NaN));

      return new PeopleWrapper(composers);
    }
View Full Code Here

    @RequestMapping(value="/music/people")
    public @ResponseBody MultiValueMap<String, Person> get() {
      MultiValueMap<String, Person> map = new LinkedMultiValueMap<String, Person>();

      map.add("composers", new Person("Johann Sebastian Bach"));
      map.add("composers", new Person("Johannes Brahms"));
      map.add("composers", new Person("Edvard Grieg"));
      map.add("composers", new Person("Robert Schumann"));

      map.add("performers", new Person("Vladimir Ashkenazy"));
      map.add("performers", new Person("Yehudi Menuhin"));

      return map;
    }
View Full Code Here

    @RequestMapping(value="/music/people")
    public @ResponseBody PeopleWrapper getPeople() {

      List<Person> composers = Arrays.asList(
          new Person("Johann Sebastian Bach").setSomeDouble(21),
          new Person("Johannes Brahms").setSomeDouble(.0025),
          new Person("Edvard Grieg").setSomeDouble(1.6035),
          new Person("Robert Schumann").setSomeDouble(Double.NaN));

      List<Person> performers = Arrays.asList(
          new Person("Vladimir Ashkenazy").setSomeBoolean(false),
          new Person("Yehudi Menuhin").setSomeBoolean(true));

      return new PeopleWrapper(composers, performers);
    }
View Full Code Here

TOP

Related Classes of org.springframework.test.web.Person

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.