### Question:
HerokuApiWrapperImpl implements HerokuApiWrapper { @Override public HerokuAppDetails getAppDetails(String externalId, String accessToken) { logger.debug("Getting Heroku app details for {}", externalId); HttpHeaders headers = new HttpHeaders(); headers.set("Accept", "application/vnd.heroku+json; version=3"); headers.set("Authorization", "Bearer " + accessToken); String url = String.format("%s/addons/%s", settings.getHerokuApiBaseUrl(), externalId); ResponseEntity<String> json = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(null, headers), String.class); String appId = JsonPath.read(json.getBody(), "$.app.id"); String appName = JsonPath.read(json.getBody(), "$.app.name"); url = String.format("%s/apps/%s", settings.getHerokuApiBaseUrl(), appId); json = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(null, headers), String.class); String ownerEmail = JsonPath.read(json.getBody(), "$.owner.email"); return HerokuAppDetails.builder().appName(appName).ownerEmail(ownerEmail).build(); }  @Override HerokuOAuthTokenResponse exchangeGrantCode(HerokuProvisionRequest.OAuthGrant grant); @Override HerokuOAuthTokenResponse refreshAccessToken(String refreshToken); @Override HerokuAppDetails getAppDetails(String externalId, String accessToken);  }### Answer:
@Test public void should_get_app_details() throws IOException { givenThat( get("/addons/some-external-id") .withHeader("Authorization", new EqualToPattern("Bearer some-access-token")) .withHeader("Accept", new EqualToPattern("application/vnd.heroku+json; version=3")) .willReturn(okJson(readResource("/heroku/sample-heroku-addons-response.json")))); givenThat( get("/apps/some-app-id") .withHeader("Authorization", new EqualToPattern("Bearer some-access-token")) .withHeader("Accept", new EqualToPattern("application/vnd.heroku+json; version=3")) .willReturn(okJson(readResource("/heroku/sample-heroku-apps-response.json")))); HerokuAppDetails appDetails = herokuApiWrapper.getAppDetails("some-external-id", "some-access-token"); assertThat( appDetails, is( HerokuAppDetails.builder() .appName("some-app-name") .ownerEmail("some-owner-email") .build())); }