1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.juneau.soap;
18
19 import static org.apache.juneau.commons.utils.CollectionUtils.*;
20 import static org.junit.jupiter.api.Assertions.*;
21
22 import java.util.function.*;
23
24 import org.apache.juneau.*;
25 import org.apache.juneau.commons.reflect.*;
26 import org.apache.juneau.soap.annotation.*;
27 import org.apache.juneau.svl.*;
28 import org.junit.jupiter.api.*;
29
30
31
32
33 class SoapXmlConfigAnnotationTest extends TestBase {
34
35 private static void check(String expected, Object o) {
36 assertEquals(expected, TO_STRING.apply(o));
37 }
38
39 private static final Function<Object,String> TO_STRING = Object::toString;
40
41 static VarResolverSession sr = VarResolver.create().vars(XVar.class).build().createSession();
42
43
44
45
46
47 @SoapXmlConfig(
48 soapAction="$X{foo}"
49 )
50 static class A {}
51 static ClassInfo a = ClassInfo.of(A.class);
52
53 @Test void basic() {
54 var al = AnnotationWorkList.of(sr, rstream(a.getAnnotations()));
55 var x = SoapXmlSerializer.create().apply(al).build().getSession();
56 check("foo", x.getSoapAction());
57 }
58
59
60
61
62
63 @SoapXmlConfig()
64 static class B {}
65 static ClassInfo b = ClassInfo.of(B.class);
66
67 @Test void noValues() {
68 var al = AnnotationWorkList.of(sr, rstream(b.getAnnotations()));
69 var x = SoapXmlSerializer.create().apply(al).build().getSession();
70 check("http://www.w3.org/2003/05/soap-envelope", x.getSoapAction());
71 }
72
73
74
75
76
77 static class C {}
78 static ClassInfo c = ClassInfo.of(C.class);
79
80 @Test void noAnnotation() {
81 var al = AnnotationWorkList.of(sr, rstream(c.getAnnotations()));
82 var x = SoapXmlSerializer.create().apply(al).build().getSession();
83 check("http://www.w3.org/2003/05/soap-envelope", x.getSoapAction());
84 }
85 }