View Javadoc

1   /*
2    * $Id: UriEncodingTestCase.java 19026 2010-08-16 07:30:47Z 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  public class UriEncodingTestCase extends AbstractIBeansTestCase
16  {
17      @SuppressWarnings("unused")    
18      @IntegrationBean
19      private TestUriIBean test;
20  
21      @Test
22      public void testEncoding1() throws Exception
23      {
24          String param = "This is a value with spaces";
25          String result = test.doSomething(param);
26  
27          assertEquals("http://" + TestUriIBean.DO_SOMETHING_URI + "This+is+a+value+with+spaces", result);
28      }
29  
30      @Test
31      public void testEncoding2() throws Exception
32      {
33          String param = "This%20is%20a%20value%20with%20spaces";
34          String result = test.doSomething(param);
35  
36          assertEquals("http://" + TestUriIBean.DO_SOMETHING_URI + "This%20is%20a%20value%20with%20spaces", result);
37      }
38  }