1
2
3
4
5
6
7
8
9
10 package org.mule.module.ibeans.annotations;
11
12 import java.net.UnknownHostException;
13
14 import org.ibeans.annotation.IntegrationBean;
15 import org.junit.Ignore;
16 import org.junit.Test;
17
18 import static org.junit.Assert.assertEquals;
19
20 public class OptionalParamsTestCase extends AbstractIBeansTestCase
21 {
22 @IntegrationBean
23 private TestUriIBean test;
24
25 @Test
26 public void testOptionalParams() throws Exception
27 {
28 String result = test.doSomethingOptional("x", "y");
29 assertEquals("http://doesnotexist.bom?param1=x¶m2=y", result);
30
31 result = test.doSomethingOptional("x", null);
32 assertEquals("http://doesnotexist.bom?param1=x", result);
33
34 result = test.doSomethingOptional(null, "y");
35 assertEquals("http://doesnotexist.bom?param2=y", result);
36 }
37
38 @Test(expected = IllegalArgumentException.class)
39 @Ignore("TODO: test is wrong because uses the expected attribute but that exception is never thrown. Running" +
40 " the test you get java.lang.reflect.UndeclaredThrowableException instead of the IllegalArgumentException")
41 public void paramNull() throws UnknownHostException
42 {
43 test.doSomethingElse("x", null);
44 }
45 }