01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.wicket.request.target.coding;
18:
19: import org.apache.wicket.IRequestTarget;
20: import org.apache.wicket.PageParameters;
21: import org.apache.wicket.WicketTestCase;
22: import org.apache.wicket.request.target.component.BookmarkablePageRequestTarget;
23: import org.slf4j.Logger;
24: import org.slf4j.LoggerFactory;
25:
26: /**
27: * Tests for {@link QueryStringUrlCodingStrategy}
28: *
29: * @author <a href="mailto:jbq@apache.org">Jean-Baptiste Quenot</a>
30: */
31: public class QueryStringUrlCodingStrategyTest extends WicketTestCase {
32: private static final Logger log = LoggerFactory
33: .getLogger(QueryStringUrlCodingStrategyTest.class);
34:
35: /**
36: * Tests mounting.
37: */
38: public void testQS() {
39: IRequestTargetUrlCodingStrategy ucs = new QueryStringUrlCodingStrategy(
40: "/mount/point", TestPage.class);
41: PageParameters params = new PageParameters();
42: params.add("a", "1");
43: params.add("a", "2");
44: params.add("b", "1");
45: IRequestTarget rt = new BookmarkablePageRequestTarget(
46: TestPage.class, params);
47: String path = ucs.encode(rt).toString();
48: log.debug(path);
49: assertEquals("mount/point/?a=1&a=2&b=1", path);
50: }
51: }
|