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 import static org.junit.Assert.assertEquals;
22 import static org.junit.Assert.assertNotNull;
23
24 @ContainsTransformerMethods
25 public class ReturnAnnotationTestCase extends AbstractIBeansTestCase
26 {
27 @IntegrationBean
28 private SearchIBean search;
29
30 @Test
31 public void testReturnCallURL() throws Exception
32 {
33 if (isOffline(getClass().getName() + ".testReturnCallURL"))
34 {
35 return;
36 }
37
38 String result = search.searchGoogleAndReturnURLString("foo");
39 assertNotNull(result);
40 assertEquals("http://www.google.com/search?q=foo", result);
41
42 URL url = search.searchGoogleAndReturnURL("foo");
43 assertNotNull(url);
44 assertEquals("http://www.google.com/search?q=foo", url.toString());
45 }
46
47 @Transformer
48 public URL stringToURL(String urlString) throws MalformedURLException
49 {
50 return new URL(urlString);
51 }
52 }