use of com.vaadin.flow.router.QueryParameters in project flow by vaadin.
the class LocationTest method locationWithParametersPath_withTrailingSlash.
@Test
public void locationWithParametersPath_withTrailingSlash() {
String initialPath = "foo/bar/";
QueryParameters queryParams = getQueryParameters();
Location location = new Location(initialPath, queryParams);
String pathWithParameters = location.getPathWithQueryParameters();
assertEquals(initialPath + '?' + queryParams.getQueryString(), pathWithParameters);
}
use of com.vaadin.flow.router.QueryParameters in project flow by vaadin.
the class LocationTest method locationWithParamsInUrl.
@Test
public void locationWithParamsInUrl() {
String initialPath = "foo/bar/";
QueryParameters queryParams = getQueryParameters();
Location location = new Location(initialPath, queryParams);
assertEquals("foo/bar/", location.getPath());
assertEquals(queryParams.getParameters(), location.getQueryParameters().getParameters());
}
use of com.vaadin.flow.router.QueryParameters in project flow by vaadin.
the class QueryParametersTest method simpleParameters.
@Test
public void simpleParameters() {
QueryParameters simpleParams = QueryParameters.simple(getSimpleInputParameters());
Map<String, List<String>> expectedFullParams = new HashMap<>();
expectedFullParams.put("one", Collections.singletonList("1"));
expectedFullParams.put("two", Collections.singletonList("2"));
expectedFullParams.put("three", Collections.singletonList("3"));
assertEquals(expectedFullParams, simpleParams.getParameters());
}
use of com.vaadin.flow.router.QueryParameters in project flow by vaadin.
the class QueryParametersTest method simpleParametersToQueryString.
@Test
public void simpleParametersToQueryString() {
QueryParameters simpleParams = QueryParameters.simple(getSimpleInputParameters());
String queryString = simpleParams.getQueryString();
assertTrue(queryString.contains("one=1"));
assertTrue(queryString.contains("two=2"));
assertTrue(queryString.contains("three=3"));
assertTrue(queryString.contains("&"));
assertNumberOfOccurences(queryString, 2, "&");
}
use of com.vaadin.flow.router.QueryParameters in project flow by vaadin.
the class QueryParametersTest method complexParameters.
@Test
public void complexParameters() {
QueryParameters fullParams = QueryParameters.full(getFullInputParameters());
Map<String, List<String>> expectedFullParams = new HashMap<>();
expectedFullParams.put("one", Arrays.asList("1", "11"));
expectedFullParams.put("two", Arrays.asList("2", "22"));
expectedFullParams.put("three", Collections.singletonList("3"));
assertEquals(expectedFullParams, fullParams.getParameters());
}
Aggregations