View Javadoc

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