@@ -0,0 +1,2381 @@
+package de.ronnyfriedland.knowledgebase.resource.xml;%0A%0Aimport java.security.MessageDigest;%0Aimport java.util.Collections;%0A%0Aimport javax.ws.rs.core.Response;%0Aimport javax.xml.bind.Marshaller;%0Aimport javax.xml.bind.Unmarshaller;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.InjectMocks;%0Aimport org.mockito.Mock;%0Aimport org.mockito.Mockito;%0Aimport org.mockito.MockitoAnnotations;%0A%0Aimport de.ronnyfriedland.knowledgebase.entity.Document;%0Aimport de.ronnyfriedland.knowledgebase.repository.IRepository;%0A%0Apublic class XmlDocumentResourceTest %7B%0A%0A    @InjectMocks%0A    private XmlDocumentResource subject;%0A%0A    @Mock%0A    private IRepository repository;%0A%0A    @Mock%0A    private MessageDigest digest;%0A%0A    @Mock%0A    private Marshaller marshaller;%0A%0A    @Mock%0A    private Unmarshaller unmarshaller;%0A%0A    @Before%0A    public void init() throws Exception %7B%0A        MockitoAnnotations.initMocks(this);%0A%0A        Mockito.when(repository.listTextDocuments(0, 100, %22tag1%22)).thenReturn(%0A                Collections.singletonList(new Document%3CString%3E(%22valid-id%22, %22valid-id%22, %22Hello World%22, %22tag1%22, %22tag2%22)));%0A        Mockito.when(repository.searchTextDocuments(0, 100, %22valid-search%22)).thenReturn(%0A                Collections.singletonList(new Document%3CString%3E(%22valid-search%22, %22valid-search%22, %22Hello World%22, %22tag1%22,%0A                        %22tag2%22)));%0A    %7D%0A%0A    @Test%0A    public void testExportXml() %7B%0A        Response result1 = subject.exportXml(0, 100, %22tag1%22, %22%22);%0A        Assert.assertNotNull(result1);%0A        Assert.assertEquals(200, result1.getStatus());%0A        Assert.assertNotNull(result1.getMetadata().get(%22Content-Disposition%22));%0A        Assert.assertNotNull(result1.getMetadata().get(%22Content-Type%22));%0A        Assert.assertNull(result1.getMetadata().get(%22unknown%22));%0A%0A        Response result2 = subject.exportXml(0, 100, %22%22, %22valid-search%22);%0A        Assert.assertNotNull(result2);%0A        Assert.assertEquals(200, result1.getStatus());%0A    %7D%0A%0A    @Test%0A    public void testImportXml() %7B%0A        for (String param1 : new String%5B%5D %7B null, %22%22, %22test.xml%22 %7D) %7B%0A            for (String param2 : new String%5B%5D %7B null, %22%22, %22%3Centries/%3E%22 %7D) %7B%0A                Response result1 = subject.importXml(param1, param2);%0A                Assert.assertNotNull(result1);%0A                Assert.assertEquals(301, result1.getStatus());%0A            %7D%0A        %7D%0A    %7D%0A%0A%7D%0A

add tests