@SuppressWarnings("ThrowableNotThrown") @Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionIfFailedToParseJson() { target.fromResponseBody("This string cannot be properly parsed", HttpStatus.INTERNAL_SERVER_ERROR); }
public MarqetaError fromResponseBody(String responseBody, HttpStatus statusCode) { MarqetaError instance; try { instance = objectMapper.readValue(responseBody, MarqetaError.class); } catch (Exception cause) { throw new IllegalArgumentException("Failed to parse Marqeta error as JSON", cause); } instance.setStatusCode(statusCode); return instance; }
MarqetaErrorFactory { public MarqetaError fromResponseBody(String responseBody, HttpStatus statusCode) { MarqetaError instance; try { instance = objectMapper.readValue(responseBody, MarqetaError.class); } catch (Exception cause) { throw new IllegalArgumentException("Failed to parse Marqeta error as JSON", cause); } instance.setStatusCode(statusCode); return instance; } }
MarqetaErrorFactory { public MarqetaError fromResponseBody(String responseBody, HttpStatus statusCode) { MarqetaError instance; try { instance = objectMapper.readValue(responseBody, MarqetaError.class); } catch (Exception cause) { throw new IllegalArgumentException("Failed to parse Marqeta error as JSON", cause); } instance.setStatusCode(statusCode); return instance; } @Autowired  MarqetaErrorFactory(ObjectMapper objectMapper); }
MarqetaErrorFactory { public MarqetaError fromResponseBody(String responseBody, HttpStatus statusCode) { MarqetaError instance; try { instance = objectMapper.readValue(responseBody, MarqetaError.class); } catch (Exception cause) { throw new IllegalArgumentException("Failed to parse Marqeta error as JSON", cause); } instance.setStatusCode(statusCode); return instance; } @Autowired  MarqetaErrorFactory(ObjectMapper objectMapper); MarqetaError fromResponseBody(String responseBody, HttpStatus statusCode); }
MarqetaErrorFactory { public MarqetaError fromResponseBody(String responseBody, HttpStatus statusCode) { MarqetaError instance; try { instance = objectMapper.readValue(responseBody, MarqetaError.class); } catch (Exception cause) { throw new IllegalArgumentException("Failed to parse Marqeta error as JSON", cause); } instance.setStatusCode(statusCode); return instance; } @Autowired  MarqetaErrorFactory(ObjectMapper objectMapper); MarqetaError fromResponseBody(String responseBody, HttpStatus statusCode);  }