@Test public void getAll() throws Exception { store.put("doc1", jsonNode1); store.put("doc2", jsonNode2); mockMvc .perform(get("/")) .andExpect(status().isOk()) .andExpect(content().contentType(APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$.doc1", is(map1))) .andExpect(jsonPath("$.doc2", is(map2))) .andReturn(); }
@GetMapping(path = "/", produces = APPLICATION_JSON_VALUE) public Map<String, JsonNode> get() throws JsonProcessingException { return store; }
RootController { @GetMapping(path = "/", produces = APPLICATION_JSON_VALUE) public Map<String, JsonNode> get() throws JsonProcessingException { return store; } }
RootController { @GetMapping(path = "/", produces = APPLICATION_JSON_VALUE) public Map<String, JsonNode> get() throws JsonProcessingException { return store; } @Autowired  RootController(@Value("#{store}") Map<String, JsonNode> store, PatchProcessor patchProcessor); }
RootController { @GetMapping(path = "/", produces = APPLICATION_JSON_VALUE) public Map<String, JsonNode> get() throws JsonProcessingException { return store; } @Autowired  RootController(@Value("#{store}") Map<String, JsonNode> store, PatchProcessor patchProcessor); @GetMapping(path = "/", produces = APPLICATION_JSON_VALUE) Map<String, JsonNode> get(); @GetMapping(path = "/{id}", produces = APPLICATION_JSON_VALUE) JsonNode get(@PathVariable String id); @PostMapping(path = "/", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) JsonNode post(@RequestBody PatchSet patchSet); @DeleteMapping(path = "/{id}", produces = APPLICATION_JSON_VALUE) JsonNode delete(@PathVariable String id); @ExceptionHandler ResponseEntity<JsonNode> handle(DocumentNotFoundException e); @ExceptionHandler ResponseEntity<JsonNode> handle(PatchApplicationException e); }
RootController { @GetMapping(path = "/", produces = APPLICATION_JSON_VALUE) public Map<String, JsonNode> get() throws JsonProcessingException { return store; } @Autowired  RootController(@Value("#{store}") Map<String, JsonNode> store, PatchProcessor patchProcessor); @GetMapping(path = "/", produces = APPLICATION_JSON_VALUE) Map<String, JsonNode> get(); @GetMapping(path = "/{id}", produces = APPLICATION_JSON_VALUE) JsonNode get(@PathVariable String id); @PostMapping(path = "/", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) JsonNode post(@RequestBody PatchSet patchSet); @DeleteMapping(path = "/{id}", produces = APPLICATION_JSON_VALUE) JsonNode delete(@PathVariable String id); @ExceptionHandler ResponseEntity<JsonNode> handle(DocumentNotFoundException e); @ExceptionHandler ResponseEntity<JsonNode> handle(PatchApplicationException e);  }