@Test(expected = RuntimeException.class) public void getDefinitionStatus500() throws IOException { HttpResponse response = response(HttpStatus.SC_INTERNAL_SERVER_ERROR, ""); when(handler.get(anyString())).thenReturn(response); underTest.get(); }
@Override public JsonNode get() { try { HttpResponse response = handler.get("roads/" + roadName); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new RuntimeException("Error from Data Highway service: " + response.getStatusLine().toString()); } return objectMapper.readTree(response.getEntity().getContent()); } catch (IOException e) { throw new RuntimeException(e); } }
DefinitionSupplier implements Supplier<JsonNode>, AutoCloseable { @Override public JsonNode get() { try { HttpResponse response = handler.get("roads/" + roadName); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new RuntimeException("Error from Data Highway service: " + response.getStatusLine().toString()); } return objectMapper.readTree(response.getEntity().getContent()); } catch (IOException e) { throw new RuntimeException(e); } } }
DefinitionSupplier implements Supplier<JsonNode>, AutoCloseable { @Override public JsonNode get() { try { HttpResponse response = handler.get("roads/" + roadName); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new RuntimeException("Error from Data Highway service: " + response.getStatusLine().toString()); } return objectMapper.readTree(response.getEntity().getContent()); } catch (IOException e) { throw new RuntimeException(e); } } DefinitionSupplier(OnrampOptions options); }
DefinitionSupplier implements Supplier<JsonNode>, AutoCloseable { @Override public JsonNode get() { try { HttpResponse response = handler.get("roads/" + roadName); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new RuntimeException("Error from Data Highway service: " + response.getStatusLine().toString()); } return objectMapper.readTree(response.getEntity().getContent()); } catch (IOException e) { throw new RuntimeException(e); } } DefinitionSupplier(OnrampOptions options); @Override JsonNode get(); @Override void close(); }
DefinitionSupplier implements Supplier<JsonNode>, AutoCloseable { @Override public JsonNode get() { try { HttpResponse response = handler.get("roads/" + roadName); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new RuntimeException("Error from Data Highway service: " + response.getStatusLine().toString()); } return objectMapper.readTree(response.getEntity().getContent()); } catch (IOException e) { throw new RuntimeException(e); } } DefinitionSupplier(OnrampOptions options); @Override JsonNode get(); @Override void close();  }