1
2
3
4
5
6
7
8
9
10 package org.mule.module.ibeans.annotations;
11
12 import org.ibeans.impl.support.util.UriParamFilter;
13 import org.junit.Test;
14
15 public class UriParamFilterTestCase extends AbstractIBeansTestCase
16 {
17 private UriParamFilter filter = new UriParamFilter();
18
19 @Test
20 public void testOptionalRemoveOneParam() throws Exception
21 {
22 String test = "http://foo.com?param=null.param";
23 test = filter.filterParamsByValue(test, "null.param");
24 assertEquals("http://foo.com", test);
25 }
26
27 @Test
28 public void testOptionalRemoveTwoParam() throws Exception
29 {
30 String test = "http://foo.com?param=null.param¶m2=foo";
31 test = filter.filterParamsByValue(test, "null.param");
32 assertEquals("http://foo.com?param2=foo", test);
33 }
34
35 @Test
36 public void testOptionalRemoveThrteeParamsMiddle() throws Exception
37 {
38 String test = "http://foo.com?param0=foo¶m1=null.param¶m2=bar";
39 test = filter.filterParamsByValue(test, "null.param");
40 assertEquals("http://foo.com?param0=foo¶m2=bar", test);
41 }
42
43 @Test
44 public void testOptionalRemoveThreeParamsEnd() throws Exception
45 {
46 String test = "http://foo.com?param0=foo¶m1=bar¶m2=null.param";
47 test = filter.filterParamsByValue(test, "null.param");
48 assertEquals("http://foo.com?param0=foo¶m1=bar", test);
49 }
50
51 @Test
52 public void testOptionalRemoveAllButOne() throws Exception
53 {
54 String test = "http://foo.com?param0=foo¶m1=null.param¶m2=null.param¶m3=null.param";
55 test = filter.filterParamsByValue(test, "null.param");
56 assertEquals("http://foo.com?param0=foo", test);
57 }
58 }