Package org.springframework.test.web

Examples of org.springframework.test.web.Person


    String responseBody = "{\"name\" : \"Ludwig van Beethoven\", \"someDouble\" : \"1.6035\"}";

    this.mockServer.expect(requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
      .andRespond(withSuccess(responseBody, MediaType.APPLICATION_JSON));

    @SuppressWarnings("unused")
    Person ludwig = restTemplate.getForObject("/composers/{id}", Person.class, 42);

    // person.getName().equals("Ludwig van Beethoven")
    // person.getDouble().equals(1.6035)
View Full Code Here


    Resource responseBody = new ClassPathResource("ludwig.json", this.getClass());

    this.mockServer.expect(requestTo("/composers/42")).andExpect(method(HttpMethod.GET))
      .andRespond(withSuccess(responseBody, MediaType.APPLICATION_JSON));

    @SuppressWarnings("unused")
    Person ludwig = restTemplate.getForObject("/composers/{id}", Person.class, 42);

    // hotel.getId() == 42
    // hotel.getName().equals("Holiday Inn")
View Full Code Here

  }

  @Test
  public void contentType() throws Exception {
    this.mockServer.expect(content().mimeType("application/json;charset=UTF-8")).andRespond(withSuccess());
    this.restTemplate.put(new URI("/foo"), new Person());
    this.mockServer.verify();
  }
View Full Code Here


  @Before
  public void setup() {
    this.people = new LinkedMultiValueMap<String, Person>();
    this.people.add("composers", new Person("Johann Sebastian Bach"));
    this.people.add("composers", new Person("Johannes Brahms"));
    this.people.add("composers", new Person("Edvard Grieg"));
    this.people.add("composers", new Person("Robert Schumann"));
    this.people.add("performers", new Person("Vladimir Ashkenazy"));
    this.people.add("performers", new Person("Yehudi Menuhin"));

    List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
    converters.add(new MappingJacksonHttpMessageConverter());

    this.restTemplate = new RestTemplate();
View Full Code Here

  @Before
  public void setup() {

    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));

    this.people = new PeopleWrapper(composers, performers);

    List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
    converters.add(new Jaxb2RootElementHttpMessageConverter());
View Full Code Here

  @Before
  public void setup() {

    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));

    this.people = new PeopleWrapper(composers);

    List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
    converters.add(new Jaxb2RootElementHttpMessageConverter());
View Full Code Here


  @Before
  public void setup() {
    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
    given(this.personDao.getPerson(5L)).willReturn(new Person("Joe"));
  }
View Full Code Here


  @Before
  public void setup() {
    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
    given(this.personDao.getPerson(5L)).willReturn(new Person("Joe"));
  }
View Full Code Here

  @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

  @Test
  public void testCallable() throws Exception {
    MvcResult mvcResult = this.mockMvc.perform(get("/1").param("callable", "true"))
      .andExpect(request().asyncStarted())
      .andExpect(request().asyncResult(new Person("Joe")))
      .andReturn();

    this.mockMvc.perform(asyncDispatch(mvcResult))
      .andExpect(status().isOk())
      .andExpect(content().contentType(MediaType.APPLICATION_JSON))
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.