View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.ibeans.annotations;
8   
9   import org.ibeans.annotation.IntegrationBean;
10  import org.junit.Test;
11  
12  import static org.junit.Assert.assertEquals;
13  
14  public class UriEncodingTestCase extends AbstractIBeansTestCase
15  {
16      @SuppressWarnings("unused")    
17      @IntegrationBean
18      private TestUriIBean test;
19  
20      @Test
21      public void testEncoding1() throws Exception
22      {
23          String param = "This is a value with spaces";
24          String result = test.doSomething(param);
25  
26          assertEquals("http://" + TestUriIBean.DO_SOMETHING_URI + "This+is+a+value+with+spaces", result);
27      }
28  
29      @Test
30      public void testEncoding2() throws Exception
31      {
32          String param = "This%20is%20a%20value%20with%20spaces";
33          String result = test.doSomething(param);
34  
35          assertEquals("http://" + TestUriIBean.DO_SOMETHING_URI + "This%20is%20a%20value%20with%20spaces", result);
36      }
37  }