1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package com.hack23.cia.testfoundation;
20
21 import java.io.BufferedReader;
22 import java.io.File;
23 import java.io.FileInputStream;
24 import java.io.InputStreamReader;
25 import java.nio.charset.StandardCharsets;
26
27 import javax.xml.transform.stream.StreamSource;
28
29 import org.springframework.oxm.Unmarshaller;
30
31
32
33
34
35
36
37 public abstract class AbstractUnmarshallXmlTest<T> extends AbstractFunctionalIntegrationTest {
38
39
40
41
42 public AbstractUnmarshallXmlTest() {
43 super();
44 }
45
46
47
48
49
50
51
52
53
54
55
56
57 protected final T unmarshallXml(final Unmarshaller unmarshaller,final String filename) throws Exception {
58 final BufferedReader inputStream= new BufferedReader(new InputStreamReader(new FileInputStream(new File(filename)),StandardCharsets.UTF_8));
59
60 return (T) unmarshaller.unmarshal(new StreamSource(inputStream));
61 }
62 }