Package feign

Examples of feign.MethodMetadata.template()


        String pathValue = emptyToNull(path.value());
        checkState(pathValue != null, "Path.value() was empty on type %s", method.getDeclaringClass().getName());
        if (!pathValue.startsWith("/")) {
            pathValue = "/" + pathValue;
        }
        md.template().insert(0, pathValue);
      }
      return md;
    }

    @Override
View Full Code Here


  }

  @Test public void requestLineOnlyRequiresMethod() throws Exception {
    MethodMetadata md = contract.parseAndValidatateMetadata(CustomMethodAndURIParam.class.getDeclaredMethod("patch",
        URI.class));
    assertEquals(md.template().method(), "PATCH");
    assertEquals(md.template().url(), "");
    assertTrue(md.template().queries().isEmpty());
    assertTrue(md.template().headers().isEmpty());
    assertNull(md.template().body());
    assertNull(md.template().bodyTemplate());
View Full Code Here

  @Test public void requestLineOnlyRequiresMethod() throws Exception {
    MethodMetadata md = contract.parseAndValidatateMetadata(CustomMethodAndURIParam.class.getDeclaredMethod("patch",
        URI.class));
    assertEquals(md.template().method(), "PATCH");
    assertEquals(md.template().url(), "");
    assertTrue(md.template().queries().isEmpty());
    assertTrue(md.template().headers().isEmpty());
    assertNull(md.template().body());
    assertNull(md.template().bodyTemplate());
    assertEquals(md.urlIndex(), Integer.valueOf(0));
View Full Code Here

  @Test public void requestLineOnlyRequiresMethod() throws Exception {
    MethodMetadata md = contract.parseAndValidatateMetadata(CustomMethodAndURIParam.class.getDeclaredMethod("patch",
        URI.class));
    assertEquals(md.template().method(), "PATCH");
    assertEquals(md.template().url(), "");
    assertTrue(md.template().queries().isEmpty());
    assertTrue(md.template().headers().isEmpty());
    assertNull(md.template().body());
    assertNull(md.template().bodyTemplate());
    assertEquals(md.urlIndex(), Integer.valueOf(0));
  }
View Full Code Here

    MethodMetadata md = contract.parseAndValidatateMetadata(CustomMethodAndURIParam.class.getDeclaredMethod("patch",
        URI.class));
    assertEquals(md.template().method(), "PATCH");
    assertEquals(md.template().url(), "");
    assertTrue(md.template().queries().isEmpty());
    assertTrue(md.template().headers().isEmpty());
    assertNull(md.template().body());
    assertNull(md.template().bodyTemplate());
    assertEquals(md.urlIndex(), Integer.valueOf(0));
  }
View Full Code Here

        URI.class));
    assertEquals(md.template().method(), "PATCH");
    assertEquals(md.template().url(), "");
    assertTrue(md.template().queries().isEmpty());
    assertTrue(md.template().headers().isEmpty());
    assertNull(md.template().body());
    assertNull(md.template().bodyTemplate());
    assertEquals(md.urlIndex(), Integer.valueOf(0));
  }

  interface WithQueryParamsInPath {
View Full Code Here

    assertEquals(md.template().method(), "PATCH");
    assertEquals(md.template().url(), "");
    assertTrue(md.template().queries().isEmpty());
    assertTrue(md.template().headers().isEmpty());
    assertNull(md.template().body());
    assertNull(md.template().bodyTemplate());
    assertEquals(md.urlIndex(), Integer.valueOf(0));
  }

  interface WithQueryParamsInPath {
    @GET @Path("/") Response none();
View Full Code Here

  }

  @Test public void queryParamsInPathExtract() throws Exception {
    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("none"));
      assertEquals(md.template().url(), "/");
      assertTrue(md.template().queries().isEmpty());
      assertEquals(md.template().toString(), "GET / HTTP/1.1\n");
    }
    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("one"));
View Full Code Here

  @Test public void queryParamsInPathExtract() throws Exception {
    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("none"));
      assertEquals(md.template().url(), "/");
      assertTrue(md.template().queries().isEmpty());
      assertEquals(md.template().toString(), "GET / HTTP/1.1\n");
    }
    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("one"));
      assertEquals(md.template().url(), "/");
View Full Code Here

  @Test public void queryParamsInPathExtract() throws Exception {
    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("none"));
      assertEquals(md.template().url(), "/");
      assertTrue(md.template().queries().isEmpty());
      assertEquals(md.template().toString(), "GET / HTTP/1.1\n");
    }
    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("one"));
      assertEquals(md.template().url(), "/");
      assertEquals(md.template().queries().get("Action"), ImmutableSet.of("GetUser"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.