@Test public void testRemoteApiExceptionHandler() { int errorCode = -1; String errorMessage = "errorMessage"; RemoteApiException e = new RemoteApiException(errorCode,errorMessage); ResponseEntity<String> expected = ResponseEntity.status(errorCode).body(e.getMessage()); ResponseEntity response = webHookDispatcherResource.handleRemoteApiException(e); assertEquals(expected,response); }
@ExceptionHandler(RemoteApiException.class) public ResponseEntity<String> handleRemoteApiException(RemoteApiException e) { LOGGER.error(e.getMessage(), e); return ResponseEntity.status(e.getCode()).body(e.getMessage()); }
WebHookDispatcherResource extends WebHookResource { @ExceptionHandler(RemoteApiException.class) public ResponseEntity<String> handleRemoteApiException(RemoteApiException e) { LOGGER.error(e.getMessage(), e); return ResponseEntity.status(e.getCode()).body(e.getMessage()); } }
WebHookDispatcherResource extends WebHookResource { @ExceptionHandler(RemoteApiException.class) public ResponseEntity<String> handleRemoteApiException(RemoteApiException e) { LOGGER.error(e.getMessage(), e); return ResponseEntity.status(e.getCode()).body(e.getMessage()); }  }
WebHookDispatcherResource extends WebHookResource { @ExceptionHandler(RemoteApiException.class) public ResponseEntity<String> handleRemoteApiException(RemoteApiException e) { LOGGER.error(e.getMessage(), e); return ResponseEntity.status(e.getCode()).body(e.getMessage()); }  @RequestMapping(value = "/{configurationType}/{configurationId}/{hash}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> handleFormRequest(@PathVariable String hash,
      @PathVariable String configurationId, @PathVariable String configurationType,
      HttpServletRequest request); @RequestMapping(value = "/{configurationId}/{hash}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> handleFormRequest(@PathVariable String hash,
      @PathVariable String configurationId, HttpServletRequest request); @RequestMapping(value = "/{configurationType}/{configurationId}/{hash}", consumes = MediaType.ALL_VALUE, method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> handleRequest(@PathVariable String hash,
      @PathVariable String configurationId, @PathVariable String configurationType,
      @RequestBody String body, HttpServletRequest request); @RequestMapping(value = "/{configurationId}/{hash}", consumes = MediaType.ALL_VALUE, method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> handleRequest(@PathVariable String hash,
      @PathVariable String configurationId, @RequestBody String body, HttpServletRequest request); @RequestMapping(value = "/{configurationType}/{configurationId}/{hash}", method = RequestMethod.HEAD) ResponseEntity<Void> handleHeadRequest(@PathVariable String hash,
      @PathVariable String configurationId, @PathVariable String configurationType); @RequestMapping(value = "/{configurationId}/{hash}", method = RequestMethod.HEAD) ResponseEntity<Void> handleHeadRequest(@PathVariable String hash,
      @PathVariable String configurationId); @RequestMapping(value = "/{configurationType}/{configurationId}/{hash}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> handleMultiPartFormDataRequest(@PathVariable String hash,
      @PathVariable String configurationId, @PathVariable String configurationType,
      @RequestPart(value = "message") String message,
      @RequestPart(value = "data", required = false) String data, HttpServletRequest request); @RequestMapping(value = "/{configurationId}/{hash}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> handleMultiPartFormDataRequest(@PathVariable String hash,
      @PathVariable String configurationId, @RequestPart(value = "message") String message,
      @RequestPart(value = "data", required = false) String data, HttpServletRequest request); @ExceptionHandler(RemoteApiException.class) ResponseEntity<String> handleRemoteApiException(RemoteApiException e); }
WebHookDispatcherResource extends WebHookResource { @ExceptionHandler(RemoteApiException.class) public ResponseEntity<String> handleRemoteApiException(RemoteApiException e) { LOGGER.error(e.getMessage(), e); return ResponseEntity.status(e.getCode()).body(e.getMessage()); }  @RequestMapping(value = "/{configurationType}/{configurationId}/{hash}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> handleFormRequest(@PathVariable String hash,
      @PathVariable String configurationId, @PathVariable String configurationType,
      HttpServletRequest request); @RequestMapping(value = "/{configurationId}/{hash}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> handleFormRequest(@PathVariable String hash,
      @PathVariable String configurationId, HttpServletRequest request); @RequestMapping(value = "/{configurationType}/{configurationId}/{hash}", consumes = MediaType.ALL_VALUE, method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> handleRequest(@PathVariable String hash,
      @PathVariable String configurationId, @PathVariable String configurationType,
      @RequestBody String body, HttpServletRequest request); @RequestMapping(value = "/{configurationId}/{hash}", consumes = MediaType.ALL_VALUE, method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> handleRequest(@PathVariable String hash,
      @PathVariable String configurationId, @RequestBody String body, HttpServletRequest request); @RequestMapping(value = "/{configurationType}/{configurationId}/{hash}", method = RequestMethod.HEAD) ResponseEntity<Void> handleHeadRequest(@PathVariable String hash,
      @PathVariable String configurationId, @PathVariable String configurationType); @RequestMapping(value = "/{configurationId}/{hash}", method = RequestMethod.HEAD) ResponseEntity<Void> handleHeadRequest(@PathVariable String hash,
      @PathVariable String configurationId); @RequestMapping(value = "/{configurationType}/{configurationId}/{hash}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> handleMultiPartFormDataRequest(@PathVariable String hash,
      @PathVariable String configurationId, @PathVariable String configurationType,
      @RequestPart(value = "message") String message,
      @RequestPart(value = "data", required = false) String data, HttpServletRequest request); @RequestMapping(value = "/{configurationId}/{hash}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> handleMultiPartFormDataRequest(@PathVariable String hash,
      @PathVariable String configurationId, @RequestPart(value = "message") String message,
      @RequestPart(value = "data", required = false) String data, HttpServletRequest request); @ExceptionHandler(RemoteApiException.class) ResponseEntity<String> handleRemoteApiException(RemoteApiException e);  }