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