BaseExceptionHandler { public <R extends Exception> T mapException(R exception) { return mapper .getOrDefault(exception.getClass(), this::internalError) .apply(exception); } BaseExceptionHandler(); T mapException(R exception); static final String MESSAGE; static final String PROCESS_INSTANCE_ID; static final String VARIABLE; static final String NODE_INSTANCE_ID; static final String NODE_ID; static final String FAILED_NODE_ID; static final String ID; }
@Test void testMapInvalidLifeCyclePhaseException() { Object response = tested.mapException(new InvalidLifeCyclePhaseException("message")); assertThat(response).isEqualTo(badRequestResponse); }
@Test void testMapInvalidTransitionException() { Object response = tested.mapException(new InvalidTransitionException("message")); assertThat(response).isEqualTo(badRequestResponse); }
@Test void testMapNodeInstanceNotFoundException() { Object response = tested.mapException(new NodeInstanceNotFoundException("processInstanceId", "nodeInstanceId")); assertThat(response).isEqualTo(notFoundResponse); }
@Test void testMapNotAuthorizedException() { Object response = tested.mapException(new NotAuthorizedException("message")); assertThat(response).isEqualTo(forbiddenResponse); }
@Test void testMapProcessInstanceDuplicatedException() { Object response = tested.mapException(new ProcessInstanceDuplicatedException("processInstanceId")); assertThat(response).isEqualTo(conflictResponse); }
@Test void testMapProcessInstanceExecutionException() { Object response = tested.mapException(new ProcessInstanceExecutionException("processInstanceId", "nodeId", "message")); assertThat(response).isEqualTo(internalErrorResponse); }
@Test void testMapProcessInstanceNotFoundException() { Object response = tested.mapException(new ProcessInstanceNotFoundException("processInstanceId")); assertThat(response).isEqualTo(notFoundResponse); }
@Test void testMapVariableViolationException() { Object response = tested.mapException(new VariableViolationException("processInstanceId", "variable", "message")); assertThat(response).isEqualTo(badRequestResponse); }