ApacheHeaders implements Headers { public Link getLink(String rel) { getLinks(); for(Link link : links) { if(link.getRel().equals(rel)) { return link; } } return null; } ApacheHeaders(HttpResponse response, RestClient client); String getMain(String key); List<String> get(String key); String getFirst(String key); List<Link> getLinks(); Link getLink(String rel); Iterator<br.com.caelum.restfulie.http.Header> iterator();  }
@Test public void shouldReturnALinkGivenTheRelValue() { when(header.getName()).thenReturn("link"); when(header.getValue()).thenReturn("<http: when(response.getHeaders("link")).thenReturn(new org.apache.http.Header[] {header}); Link link = new ApacheHeaders(response,client).getLink("west"); assertThat(link.getHref(), is(equalTo("http: assertThat(link.getRel(), is(equalTo("west"))); }