Polishing

This commit is contained in:
Juergen Hoeller
2015-09-04 14:38:47 +02:00
parent 811de8e50b
commit 667fc7e4a9
12 changed files with 32 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,22 +38,21 @@ public class ResponseBodyTests {
@Test
public void json() throws Exception {
standaloneSetup(new PersonController()).build()
.perform(get("/person/Lee").accept(MediaType.APPLICATION_JSON))
.perform(get("/person/Lee").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$.name").value("Lee"));
}
@Controller
private class PersonController {
@RequestMapping(value="/person/{name}")
@ResponseBody
public Person get(@PathVariable String name) {
Person person = new Person(name);
return person;
return new Person(name);
}
}