@Test public void getAuthor() throws Exception { authorRepository.save(author); restAuthorMockMvc.perform(get("/app/rest/authors/{id}", author.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(author.getId())) .andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString())) .andExpect(jsonPath("$.birthDate").value(DEFAULT_BIRTH_DATE.toString())); }
@RequestMapping(value = "/rest/authors/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Author> get(@PathVariable String id) { log.debug("REST request to get Author : {}", id); return Optional.ofNullable(authorRepository.findOne(id)) .map(author -> new ResponseEntity<>( author, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND)); }
AuthorResource { @RequestMapping(value = "/rest/authors/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Author> get(@PathVariable String id) { log.debug("REST request to get Author : {}", id); return Optional.ofNullable(authorRepository.findOne(id)) .map(author -> new ResponseEntity<>( author, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND)); } }
AuthorResource { @RequestMapping(value = "/rest/authors/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Author> get(@PathVariable String id) { log.debug("REST request to get Author : {}", id); return Optional.ofNullable(authorRepository.findOne(id)) .map(author -> new ResponseEntity<>( author, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND)); }  }
AuthorResource { @RequestMapping(value = "/rest/authors/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Author> get(@PathVariable String id) { log.debug("REST request to get Author : {}", id); return Optional.ofNullable(authorRepository.findOne(id)) .map(author -> new ResponseEntity<>( author, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND)); }  @RequestMapping(value = "/rest/authors", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed void create(@RequestBody Author author); @RequestMapping(value = "/rest/authors", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed List<Author> getAll(); @RequestMapping(value = "/rest/authors/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed ResponseEntity<Author> get(@PathVariable String id); @RequestMapping(value = "/rest/authors/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @Timed void delete(@PathVariable String id); }
AuthorResource { @RequestMapping(value = "/rest/authors/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Author> get(@PathVariable String id) { log.debug("REST request to get Author : {}", id); return Optional.ofNullable(authorRepository.findOne(id)) .map(author -> new ResponseEntity<>( author, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND)); }  @RequestMapping(value = "/rest/authors", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed void create(@RequestBody Author author); @RequestMapping(value = "/rest/authors", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed List<Author> getAll(); @RequestMapping(value = "/rest/authors/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed ResponseEntity<Author> get(@PathVariable String id); @RequestMapping(value = "/rest/authors/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @Timed void delete(@PathVariable String id);  }