Examples of UriComponents


Examples of org.springframework.web.util.UriComponents

    assertThat(uriComponents.toUriString(), is("http://localhost/"));
  }

  @Test
  public void testFromMethodNamePathVariable() throws Exception {
    UriComponents uriComponents = fromMethodName(
        ControllerWithMethods.class, "methodWithPathVariable", new Object[]{"1"}).build();

    assertThat(uriComponents.toUriString(), is("http://localhost/something/1/foo"));
  }
View Full Code Here

Examples of org.springframework.web.util.UriComponents

  }

  @Test
  public void testFromMethodNameTypeLevelPathVariable() throws Exception {
    this.request.setContextPath("/myapp");
    UriComponents uriComponents = fromMethodName(
        PersonsAddressesController.class, "getAddressesForCountry", "DE").buildAndExpand("1");

    assertThat(uriComponents.toUriString(), is("http://localhost/myapp/people/1/addresses/DE"));
  }
View Full Code Here

Examples of org.springframework.web.util.UriComponents

  }

  @Test
  public void testFromMethodNameTwoPathVariables() throws Exception {
    DateTime now = DateTime.now();
    UriComponents uriComponents = fromMethodName(
        ControllerWithMethods.class, "methodWithTwoPathVariables", 1, now).build();

    assertThat(uriComponents.getPath(), is("/something/1/foo/" + ISODateTimeFormat.date().print(now)));
  }
View Full Code Here

Examples of org.springframework.web.util.UriComponents

    assertThat(uriComponents.getPath(), is("/something/1/foo/" + ISODateTimeFormat.date().print(now)));
  }

  @Test
  public void testFromMethodNameWithPathVarAndRequestParam() throws Exception {
    UriComponents uriComponents = fromMethodName(
        ControllerWithMethods.class, "methodForNextPage", "1", 10, 5).build();

    assertThat(uriComponents.getPath(), is("/something/1/foo"));
    MultiValueMap<String, String> queryParams = uriComponents.getQueryParams();
    assertThat(queryParams.get("limit"), contains("5"));
    assertThat(queryParams.get("offset"), contains("10"));
  }
View Full Code Here

Examples of org.springframework.web.util.UriComponents

  // SPR-11391

  @Test
  public void testFromMethodNameTypeLevelPathVariableWithoutArgumentValue() throws Exception {
    UriComponents uriComponents = fromMethodName(UserContactController.class, "showCreate", 123).build();

    assertThat(uriComponents.getPath(), is("/user/123/contacts/create"));
  }
View Full Code Here

Examples of org.springframework.web.util.UriComponents

    assertThat(uriComponents.getPath(), is("/user/123/contacts/create"));
  }

  @Test
  public void testFromMethodNameNotMapped() throws Exception {
    UriComponents uriComponents = fromMethodName(UnmappedController.class, "unmappedMethod").build();

    assertThat(uriComponents.toUriString(), is("http://localhost/"));
  }
View Full Code Here

Examples of org.springframework.web.util.UriComponents

    assertThat(uriComponents.toUriString(), is("http://localhost/"));
  }

  @Test
  public void testFromMethodCall() {
    UriComponents uriComponents = fromMethodCall(on(ControllerWithMethods.class).myMethod(null)).build();

    assertThat(uriComponents.toUriString(), startsWith("http://localhost"));
    assertThat(uriComponents.toUriString(), endsWith("/something/else"));
  }
View Full Code Here

Examples of org.springframework.web.util.UriComponents

    assertThat(uriComponents.toUriString(), endsWith("/something/else"));
  }

  @Test
  public void testFromMethodCallWithTypeLevelUriVars() {
    UriComponents uriComponents = fromMethodCall(on(
        PersonsAddressesController.class).getAddressesForCountry("DE")).buildAndExpand(15);

    assertThat(uriComponents.toUriString(), endsWith("/people/15/addresses/DE"));
  }
View Full Code Here

Examples of org.springframework.web.util.UriComponents

  }


  @Test
  public void testFromMethodCallWithPathVar() {
    UriComponents uriComponents = fromMethodCall(on(
        ControllerWithMethods.class).methodWithPathVariable("1")).build();

    assertThat(uriComponents.toUriString(), startsWith("http://localhost"));
    assertThat(uriComponents.toUriString(), endsWith("/something/1/foo"));
  }
View Full Code Here

Examples of org.springframework.web.util.UriComponents

    assertThat(uriComponents.toUriString(), endsWith("/something/1/foo"));
  }

  @Test
  public void testFromMethodCallWithPathVarAndRequestParams() {
    UriComponents uriComponents = fromMethodCall(on(
        ControllerWithMethods.class).methodForNextPage("1", 10, 5)).build();

    assertThat(uriComponents.getPath(), is("/something/1/foo"));

    MultiValueMap<String, String> queryParams = uriComponents.getQueryParams();
    assertThat(queryParams.get("limit"), contains("5"));
    assertThat(queryParams.get("offset"), contains("10"));
  }
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.