1 不是特别会Spring MVC的知识,请问看哪本书入门比较合适啊?
2 关于这test case?- @RestController
- class HealthcheckController {
- // Your solution
- @JsonFormat(shape = JsonFormat.Shape.STRING ,pattern = "dd-MM-YYYY hh:mm:ss" , timezone="UTC")
- private Date from_date;
- @GetMapping(value = "/healthcheck", )
- public JSONObject healthcheck() {
- return new ResponseEntity<>(json,HttpStatus.OK);
- }
- @GetMapping(value = "/healthcheck?format=short", )
- public JSONObject healthcheck() {
- ObjectMapper objectMapper = new ObjectMapper();
- String jsonString = "{"status":"OK"}";
- JsonNode actualObj = objectMapper.readTree(jsonString);
- return actualObj;
- }
-
- @GetMapping(value = "/healthcheck?format=full", )
- public JSONObject healthcheck() {
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.setDateFormat(from_date);
- String jsonString = "{"status":"OK"}";
- JsonNode actualObj = objectMapper.readTree(jsonString);
- return objectMapper;
- }
- @PutMapping(value = "/healthcheck")
- public void healthcheckPut() {
- return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
- }
- @PostMapping(value = "/healthcheck")
- public void healthcheckPost() {
- return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
- }
- @DeleteMapping(value = "/healthcheck")
- public void healthcheckDelete() {
- return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
- }
- }
复制代码 |