mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-04-24 11:22:49 +00:00
Compare commits
3 commits
9432106118
...
5f30a2efb8
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5f30a2efb8 | ||
![]() |
332abbcb8a | ||
![]() |
f0be1771ad |
3 changed files with 2 additions and 18 deletions
|
@ -17,6 +17,8 @@ cd spring-petclinic
|
|||
java -jar target/*.jar
|
||||
```
|
||||
|
||||
(On Windows, or if your shell doesn't expand the glob, you might need to specify the JAR file name explicitly on the command line at the end there.)
|
||||
|
||||
You can then access the Petclinic at <http://localhost:8080/>.
|
||||
|
||||
<img width="1042" alt="petclinic-screenshot" src="https://cloud.githubusercontent.com/assets/838318/19727082/2aee6d6c-9b8e-11e6-81fe-e889a5ddfded.png">
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
|
@ -66,13 +65,4 @@ class VetController {
|
|||
return vetRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
@GetMapping({ "/vets" })
|
||||
public @ResponseBody Vets showResourcesVetList() {
|
||||
// Here we are returning an object of type 'Vets' rather than a collection of Vet
|
||||
// objects so it is simpler for JSon/Object mapping
|
||||
Vets vets = new Vets();
|
||||
vets.getVetList().addAll(this.vetRepository.findAll());
|
||||
return vets;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,12 +89,4 @@ class VetControllerTests {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
void testShowResourcesVetList() throws Exception {
|
||||
ResultActions actions = mockMvc.perform(get("/vets").accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk());
|
||||
actions.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath("$.vetList[0].id").value(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue