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