Package feign

Examples of feign.MethodMetadata.template()


    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("three"));
      assertEquals(md.template().url(), "/");
      assertEquals(md.template().queries().get("Action"), ImmutableSet.of("GetUser"));
      assertEquals(md.template().queries().get("Version"), ImmutableSet.of("2010-05-08"));
      assertEquals(md.template().queries().get("limit"), ImmutableSet.of("1"));
      assertEquals(md.template().toString(), "GET /?Action=GetUser&Version=2010-05-08&limit=1 HTTP/1.1\n");
    }
    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("empty"));
      assertEquals(md.template().url(), "/");
View Full Code Here


      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("three"));
      assertEquals(md.template().url(), "/");
      assertEquals(md.template().queries().get("Action"), ImmutableSet.of("GetUser"));
      assertEquals(md.template().queries().get("Version"), ImmutableSet.of("2010-05-08"));
      assertEquals(md.template().queries().get("limit"), ImmutableSet.of("1"));
      assertEquals(md.template().toString(), "GET /?Action=GetUser&Version=2010-05-08&limit=1 HTTP/1.1\n");
    }
    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("empty"));
      assertEquals(md.template().url(), "/");
      assertTrue(md.template().queries().containsKey("flag"));
View Full Code Here

      assertEquals(md.template().queries().get("limit"), ImmutableSet.of("1"));
      assertEquals(md.template().toString(), "GET /?Action=GetUser&Version=2010-05-08&limit=1 HTTP/1.1\n");
    }
    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("empty"));
      assertEquals(md.template().url(), "/");
      assertTrue(md.template().queries().containsKey("flag"));
      assertEquals(md.template().queries().get("Action"), ImmutableSet.of("GetUser"));
      assertEquals(md.template().queries().get("Version"), ImmutableSet.of("2010-05-08"));
      assertEquals(md.template().toString(), "GET /?flag&Action=GetUser&Version=2010-05-08 HTTP/1.1\n");
    }
View Full Code Here

      assertEquals(md.template().toString(), "GET /?Action=GetUser&Version=2010-05-08&limit=1 HTTP/1.1\n");
    }
    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("empty"));
      assertEquals(md.template().url(), "/");
      assertTrue(md.template().queries().containsKey("flag"));
      assertEquals(md.template().queries().get("Action"), ImmutableSet.of("GetUser"));
      assertEquals(md.template().queries().get("Version"), ImmutableSet.of("2010-05-08"));
      assertEquals(md.template().toString(), "GET /?flag&Action=GetUser&Version=2010-05-08 HTTP/1.1\n");
    }
  }
View Full Code Here

    }
    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("empty"));
      assertEquals(md.template().url(), "/");
      assertTrue(md.template().queries().containsKey("flag"));
      assertEquals(md.template().queries().get("Action"), ImmutableSet.of("GetUser"));
      assertEquals(md.template().queries().get("Version"), ImmutableSet.of("2010-05-08"));
      assertEquals(md.template().toString(), "GET /?flag&Action=GetUser&Version=2010-05-08 HTTP/1.1\n");
    }
  }
View Full Code Here

    {
      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("empty"));
      assertEquals(md.template().url(), "/");
      assertTrue(md.template().queries().containsKey("flag"));
      assertEquals(md.template().queries().get("Action"), ImmutableSet.of("GetUser"));
      assertEquals(md.template().queries().get("Version"), ImmutableSet.of("2010-05-08"));
      assertEquals(md.template().toString(), "GET /?flag&Action=GetUser&Version=2010-05-08 HTTP/1.1\n");
    }
  }

  interface ProducesAndConsumes {
View Full Code Here

      MethodMetadata md = contract.parseAndValidatateMetadata(WithQueryParamsInPath.class.getDeclaredMethod("empty"));
      assertEquals(md.template().url(), "/");
      assertTrue(md.template().queries().containsKey("flag"));
      assertEquals(md.template().queries().get("Action"), ImmutableSet.of("GetUser"));
      assertEquals(md.template().queries().get("Version"), ImmutableSet.of("2010-05-08"));
      assertEquals(md.template().toString(), "GET /?flag&Action=GetUser&Version=2010-05-08 HTTP/1.1\n");
    }
  }

  interface ProducesAndConsumes {
    @GET @Produces(APPLICATION_XML) Response produces();
View Full Code Here

    @POST @Consumes({""}) Response consumesEmpty();
  }

  @Test public void producesAddsAcceptHeader() throws Exception {
    MethodMetadata md = contract.parseAndValidatateMetadata(ProducesAndConsumes.class.getDeclaredMethod("produces"));
    assertEquals(md.template().headers().get(ACCEPT), ImmutableSet.of(APPLICATION_XML));
  }

  @Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "Produces.value\\(\\) was empty on method producesNada")
  public void producesNada() throws Exception {
    contract.parseAndValidatateMetadata(ProducesAndConsumes.class.getDeclaredMethod("producesNada"));
View Full Code Here

    contract.parseAndValidatateMetadata(ProducesAndConsumes.class.getDeclaredMethod("producesEmpty"));
  }

  @Test public void consumesAddsContentTypeHeader() throws Exception {
    MethodMetadata md = contract.parseAndValidatateMetadata(ProducesAndConsumes.class.getDeclaredMethod("consumes"));
    assertEquals(md.template().headers().get(CONTENT_TYPE), ImmutableSet.of(APPLICATION_JSON));
  }

  @Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "Consumes.value\\(\\) was empty on method consumesNada")
  public void consumesNada() throws Exception {
    contract.parseAndValidatateMetadata(ProducesAndConsumes.class.getDeclaredMethod("consumesNada"));
View Full Code Here

  }

  @Test public void bodyParamIsGeneric() throws Exception {
    MethodMetadata md = contract.parseAndValidatateMetadata(BodyParams.class.getDeclaredMethod("post",
        List.class));
    assertNull(md.template().body());
    assertNull(md.template().bodyTemplate());
    assertNull(md.urlIndex());
    assertEquals(md.bodyIndex(), Integer.valueOf(0));
    assertEquals(md.bodyType(), new TypeToken<List<String>>() {
    }.getType());
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.