use of com.vaadin.flow.router.QueryParameters in project flow by vaadin.
the class QueryParametersTest method parameterWithEmptyValue.
@Test
public void parameterWithEmptyValue() {
QueryParameters fullParams = new QueryParameters(Collections.singletonMap("foo", Collections.singletonList("")));
Assert.assertEquals("foo=", fullParams.getQueryString());
}
use of com.vaadin.flow.router.QueryParameters in project flow by vaadin.
the class MockServletServiceSessionSetup method createRequest.
public VaadinRequest createRequest(MockServletServiceSessionSetup mocks, String path, String queryString) {
QueryParameters queryParams = QueryParameters.fromString(queryString);
Map<String, List<String>> params = queryParams.getParameters();
HttpServletRequest httpServletRequest = Mockito.mock(HttpServletRequest.class);
return new VaadinServletRequest(httpServletRequest, mocks.getService()) {
@Override
public String getPathInfo() {
return path;
}
@Override
public String getServletPath() {
return "";
}
@Override
public ServletContext getServletContext() {
return mocks.getServletContext();
}
@Override
public String getParameter(String name) {
if (!params.containsKey(name)) {
return null;
}
return params.get(name).get(0);
}
@Override
public StringBuffer getRequestURL() {
return new StringBuffer("http://localhost:8888" + getPathInfo());
}
};
}
Aggregations