@Test
  public void methods() throws URISyntaxException {
    URI url = new URI("http://example.com");

    RequestEntity<?> entity = RequestEntity.get(url).build();
    assertEquals(HttpMethod.GET, entity.getMethod());

    entity = RequestEntity.post(url).build();
    assertEquals(HttpMethod.POST, entity.getMethod());

    entity = RequestEntity.head(url).build();
    assertEquals(HttpMethod.HEAD, entity.getMethod());

    entity = RequestEntity.options(url).build();
    assertEquals(HttpMethod.OPTIONS, entity.getMethod());

    entity = RequestEntity.put(url).build();
    assertEquals(HttpMethod.PUT, entity.getMethod());

    entity = RequestEntity.patch(url).build();
    assertEquals(HttpMethod.PATCH, entity.getMethod());

    entity = RequestEntity.delete(url).build();
    assertEquals(HttpMethod.DELETE, entity.getMethod());
  }
  @Test
  public void get() {
    RequestEntity<Void> requestEntity =
        RequestEntity.get(URI.create("http://example.com"))
            .accept(MediaType.IMAGE_GIF, MediaType.IMAGE_JPEG, MediaType.IMAGE_PNG)
            .build();

    assertNotNull(requestEntity);
    assertEquals(HttpMethod.GET, requestEntity.getMethod());
    assertTrue(requestEntity.getHeaders().containsKey("Accept"));
    assertEquals("image/gif, image/jpeg, image/png", requestEntity.getHeaders().getFirst("Accept"));
    assertNull(requestEntity.getBody());
  }
  @Test
  public void uriVariablesExpansion() throws URISyntaxException {
    URI uri = new UriTemplate("http://example.com/{foo}").expand("bar");
    RequestEntity.get(uri).accept(MediaType.TEXT_PLAIN).build();

    String url = "http://www.{host}.com/{path}";
    String host = "example";
    String path = "foo/bar";
    URI expected = new URI("http://www.example.com/foo/bar");

    uri = new UriTemplate(url).expand(host, path);
    RequestEntity<?> entity = RequestEntity.get(uri).build();
    assertEquals(expected, entity.getUrl());

    Map<String, String> uriVariables = new HashMap<>(2);
    uriVariables.put("host", host);
    uriVariables.put("path", path);

    uri = new UriTemplate(url).expand(uriVariables);
    entity = RequestEntity.get(uri).build();
    assertEquals(expected, entity.getUrl());
  }