Line | |
---|
1 | package negotiator.repository;
|
---|
2 |
|
---|
3 | import static org.junit.Assert.assertEquals;
|
---|
4 |
|
---|
5 | import java.io.StringWriter;
|
---|
6 | import java.net.MalformedURLException;
|
---|
7 | import java.net.URL;
|
---|
8 |
|
---|
9 | import javax.xml.bind.JAXBContext;
|
---|
10 | import javax.xml.bind.JAXBException;
|
---|
11 | import javax.xml.bind.Marshaller;
|
---|
12 |
|
---|
13 | import org.junit.Before;
|
---|
14 | import org.junit.Test;
|
---|
15 |
|
---|
16 | import genius.core.repository.ProfileRepItem;
|
---|
17 |
|
---|
18 | public class ProfileRepItemTest {
|
---|
19 |
|
---|
20 | private ProfileRepItem normalItem;
|
---|
21 | private String normalString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><profileRepItem url=\"file:test\"/>";
|
---|
22 |
|
---|
23 | @Before
|
---|
24 | public void before() throws MalformedURLException {
|
---|
25 | normalItem = new ProfileRepItem(new URL("file:test"), null);
|
---|
26 | }
|
---|
27 |
|
---|
28 | @Test
|
---|
29 | public void testNormalItem() throws JAXBException, MalformedURLException {
|
---|
30 |
|
---|
31 | StringWriter writer = new StringWriter();
|
---|
32 |
|
---|
33 | JAXBContext context = JAXBContext.newInstance(ProfileRepItem.class);
|
---|
34 | Marshaller m = context.createMarshaller();
|
---|
35 | m.marshal(normalItem, writer);
|
---|
36 |
|
---|
37 | assertEquals(normalString, writer.toString());
|
---|
38 | System.out.println(writer.toString());
|
---|
39 |
|
---|
40 | }
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.