1
2
3
4
5
6
7
8
9
10 package org.mule.module.ibeans.annotations;
11
12 import org.mule.api.annotations.ContainsTransformerMethods;
13 import org.mule.api.annotations.Transformer;
14
15 import java.net.MalformedURLException;
16 import java.net.URL;
17
18 import org.ibeans.annotation.IntegrationBean;
19 import org.junit.Test;
20
21 @ContainsTransformerMethods
22 public class ReturnAnnotationTestCase extends AbstractIBeansTestCase
23 {
24 @SuppressWarnings("unused")
25 @IntegrationBean
26 private SearchIBean search;
27
28 @Test
29 public void testReturnCallURL() throws Exception
30 {
31 if (isOffline(getClass().getName() + ".testReturnCallURL"))
32 {
33 return;
34 }
35
36 String result = search.searchGoogleAndReturnURLString("foo");
37 assertNotNull(result);
38 assertEquals("http://www.google.com/search?q=foo", result);
39
40 URL url = search.searchGoogleAndReturnURL("foo");
41 assertNotNull(url);
42 assertEquals("http://www.google.com/search?q=foo", url.toString());
43 }
44
45 @Transformer
46 public URL stringToURL(String urlString) throws MalformedURLException
47 {
48 return new URL(urlString);
49 }
50
51 }