// Path: src/main/java/de/jeha/s3srv/common/acl/ACLPermissions.java
// public enum ACLPermissions {
//     READ,
//     WRITE,
//     READ_ACP,
//     WRITE_ACP,
//     FULL_CONTROL;
// }
// 
// Path: src/main/java/de/jeha/s3srv/xml/JaxbMarshaller.java
// public class JaxbMarshaller {
// 
//     private static Marshaller MARSHALLER = null;
//     private static Unmarshaller UNMARSHALLER = null;
// 
//     static {
//         try {
//             MARSHALLER = JaxbContextHolder.getContext().createMarshaller();
//             MARSHALLER.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
//             MARSHALLER.setProperty(Marshaller.JAXB_FRAGMENT, true);
//         } catch (JAXBException e) {
//             throw new RuntimeException("Unable to initialize JAXB Marshaller", e);
//         }
//         try {
//             UNMARSHALLER = JaxbContextHolder.getContext().createUnmarshaller();
//         } catch (JAXBException e) {
//             throw new RuntimeException("Unable to initialize JAXB Unmarshaller", e);
//         }
//     }
// 
//     public synchronized static String marshall(Object object) throws JAXBException, IOException {
//         StringWriter stringWriter = new StringWriter();
//         stringWriter.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
//         stringWriter.append("\n");
// 
//         MARSHALLER.marshal(object, stringWriter);
//         stringWriter.close();
// 
//         return stringWriter.toString();
//     }
// 
//     public synchronized static <T> T unmarshall(String xml, Class<T> clazz) throws JAXBException, IOException {
//         return UNMARSHALLER.unmarshal(new StreamSource(new StringReader(xml)), clazz).getValue();
//     }
// 
// }


import de.jeha.s3srv.common.acl.ACLPermissions;
import de.jeha.s3srv.xml.JaxbMarshaller;
import org.junit.jupiter.api.Test;
import javax.xml.bind.JAXBException;
import java.io.IOException;
import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertEquals;
package de.jeha.s3srv.api;




/**
 * @author jenshadlich@googlemail.com
 */
public class AccessControlPolicySerializationTest {

    @Test
    public void test() throws JAXBException, IOException {
        AccessControlPolicy response = new AccessControlPolicy(
                new Owner("foo", "bar"),
                Collections.singletonList(new AccessControlPolicy.Grant(new Grantee("foo", "bar"), ACLPermissions.FULL_CONTROL.name())));

// Path: src/main/java/de/jeha/s3srv/common/acl/ACLPermissions.java
// public enum ACLPermissions {
//     READ,
//     WRITE,
//     READ_ACP,
//     WRITE_ACP,
//     FULL_CONTROL;
// }
// 
// Path: src/main/java/de/jeha/s3srv/xml/JaxbMarshaller.java
// public class JaxbMarshaller {
// 
//     private static Marshaller MARSHALLER = null;
//     private static Unmarshaller UNMARSHALLER = null;
// 
//     static {
//         try {
//             MARSHALLER = JaxbContextHolder.getContext().createMarshaller();
//             MARSHALLER.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
//             MARSHALLER.setProperty(Marshaller.JAXB_FRAGMENT, true);
//         } catch (JAXBException e) {
//             throw new RuntimeException("Unable to initialize JAXB Marshaller", e);
//         }
//         try {
//             UNMARSHALLER = JaxbContextHolder.getContext().createUnmarshaller();
//         } catch (JAXBException e) {
//             throw new RuntimeException("Unable to initialize JAXB Unmarshaller", e);
//         }
//     }
// 
//     public synchronized static String marshall(Object object) throws JAXBException, IOException {
//         StringWriter stringWriter = new StringWriter();
//         stringWriter.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
//         stringWriter.append("\n");
// 
//         MARSHALLER.marshal(object, stringWriter);
//         stringWriter.close();
// 
//         return stringWriter.toString();
//     }
// 
//     public synchronized static <T> T unmarshall(String xml, Class<T> clazz) throws JAXBException, IOException {
//         return UNMARSHALLER.unmarshal(new StreamSource(new StringReader(xml)), clazz).getValue();
//     }
// 
// }


// Path: src/test/java/de/jeha/s3srv/api/AccessControlPolicySerializationTest.java
import de.jeha.s3srv.common.acl.ACLPermissions;
import de.jeha.s3srv.xml.JaxbMarshaller;
import org.junit.jupiter.api.Test;
import javax.xml.bind.JAXBException;
import java.io.IOException;
import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertEquals;

package de.jeha.s3srv.api;




/**
 * @author jenshadlich@googlemail.com
 */
public class AccessControlPolicySerializationTest {

    @Test
    public void test() throws JAXBException, IOException {
        AccessControlPolicy response = new AccessControlPolicy(
                new Owner("foo", "bar"),
                Collections.singletonList(new AccessControlPolicy.Grant(new Grantee("foo", "bar"), ACLPermissions.FULL_CONTROL.name())));

        final String responseXml = JaxbMarshaller.marshall(response);