test_class.declarator: mapper
test_class.original_string: GeneralExceptionMapper mapper;
test_class.type: GeneralExceptionMapper
test_class.var_name: mapper
test_class.declarator: mockLogger
test_class.original_string: Logger mockLogger;
test_class.type: Logger
test_class.var_name: mockLogger
test_class.file: micro-general-exception-mapper/src/test/java/com/oath/micro/server/general/exception/mapper/GeneralExceptionMapperTest.java
test_class.identifier: GeneralExceptionMapperTest
test_case.body: @Test
  	public void whenNotFoundException_thenNotFound() {
  		assertThat(mapper.toResponse(new NotFoundException()).getStatus(), is(Status.NOT_FOUND.getStatusCode()));
  	}
test_case.class_method_signature: GeneralExceptionMapperTest.whenNotFoundException_thenNotFound()
test_case.full_signature: @Test public void whenNotFoundException_thenNotFound()
test_case.identifier: whenNotFoundException_thenNotFound
test_case.invocations: assertThat getStatus toResponse is getStatusCode
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void whenNotFoundException_thenNotFound()
focal_class.declarator: logger
focal_class.modifier: final
focal_class.original_string: final Logger logger;
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: showDetails
focal_class.modifier: private
focal_class.original_string: private Boolean showDetails;
focal_class.type: Boolean
focal_class.var_name: showDetails
focal_class.declarator: mapOfExceptionsToErrorCodes = MapOfExceptionsToErrorCodes.getMergedMappings()
focal_class.original_string: Map<Class<? extends Exception>, Tuple2<String, Status>> mapOfExceptionsToErrorCodes = MapOfExceptionsToErrorCodes.getMergedMappings();
focal_class.type: Map<Class<? extends Exception>, Tuple2<String, Status>>
focal_class.var_name: mapOfExceptionsToErrorCodes
focal_class.file: micro-general-exception-mapper/src/main/java/com/oath/micro/server/general/exception/mapper/GeneralExceptionMapper.java
focal_class.identifier: GeneralExceptionMapper
focal_class.interfaces: implements ExceptionMapper<Exception>
focal_class.class_method_signature: GeneralExceptionMapper.GeneralExceptionMapper(Logger logger, boolean showDetails)
focal_class.full_signature:   GeneralExceptionMapper(Logger logger, boolean showDetails)
focal_class.identifier: GeneralExceptionMapper
focal_class.parameters: (Logger logger, boolean showDetails)
focal_class.signature:  GeneralExceptionMapper(Logger logger, boolean showDetails)
focal_class.class_method_signature: GeneralExceptionMapper.GeneralExceptionMapper(@Value("${micro.general.exception.mapper.details:true}") Boolean showDetails)
focal_class.full_signature: @Autowired  GeneralExceptionMapper(@Value("${micro.general.exception.mapper.details:true}") Boolean showDetails)
focal_class.identifier: GeneralExceptionMapper
focal_class.modifiers: @Autowired
focal_class.parameters: (@Value("${micro.general.exception.mapper.details:true}") Boolean showDetails)
focal_class.signature:  GeneralExceptionMapper(@Value("${micro.general.exception.mapper.details:true}") Boolean showDetails)
focal_class.class_method_signature: GeneralExceptionMapper.find(Class<? extends Exception> c)
focal_class.full_signature: private Optional<Tuple2<String, Status>> find(Class<? extends Exception> c)
focal_class.identifier: find
focal_class.modifiers: private
focal_class.parameters: (Class<? extends Exception> c)
focal_class.return: Optional<Tuple2<String, Status>>
focal_class.signature: Optional<Tuple2<String, Status>> find(Class<? extends Exception> c)
focal_class.class_method_signature: GeneralExceptionMapper.toResponse(final Exception ex)
focal_class.full_signature: @Override public Response toResponse(final Exception ex)
focal_class.identifier: toResponse
focal_class.modifiers: @Override public
focal_class.parameters: (final Exception ex)
focal_class.return: Response
focal_class.signature: Response toResponse(final Exception ex)
focal_method.body: @Override
  	public Response toResponse(final Exception ex) {
  
  		final String errorTrackingId = UUID.randomUUID().toString();
  
  		Tuple2<String, Status> error = new Tuple2<>(MapOfExceptionsToErrorCodes.INTERNAL_SERVER_ERROR, Status.INTERNAL_SERVER_ERROR);
  
  		Optional<Tuple2<String, Status>> errorFromLookup = find(ex.getClass());
  
  		if (errorFromLookup.isPresent()) {
  			error = errorFromLookup.get();
  		} else {
  			if(ex instanceof javax.ws.rs.WebApplicationException){
  				javax.ws.rs.WebApplicationException rsEx = ((javax.ws.rs.WebApplicationException)ex);
  				error = tuple(rsEx.getResponse().getStatusInfo().getReasonPhrase(),Status.fromStatusCode(rsEx.getResponse().getStatus()));
  			}
  		}
  		logger.error(String.format("%s Error id: %s, %s", error._1(), errorTrackingId, ex.getMessage()), ex);
  
  		Response.ResponseBuilder responseBuilder = Response.status(error._2()).type(MediaType.APPLICATION_JSON_TYPE);
  
  		if (showDetails) {
  			responseBuilder.entity(new ExceptionWrapper(error._1(), String.format("Error id: %s %s", errorTrackingId, ex.getMessage())));
  		} else {
  			responseBuilder.entity(new ExceptionWrapper(MapOfExceptionsToErrorCodes.INTERNAL_SERVER_ERROR, errorTrackingId));
  		}
  
  		return responseBuilder.build();
  	}
focal_method.class_method_signature: GeneralExceptionMapper.toResponse(final Exception ex)
focal_method.full_signature: @Override public Response toResponse(final Exception ex)
focal_method.identifier: toResponse
focal_method.invocations: toString randomUUID find getClass isPresent get tuple getReasonPhrase getStatusInfo getResponse fromStatusCode getStatus getResponse error format _1 getMessage type status _2 entity _1 format getMessage entity build
focal_method.modifiers: @Override public
focal_method.parameters: (final Exception ex)
focal_method.return: Response
focal_method.signature: Response toResponse(final Exception ex)