// Path: copybook4java/src/main/java/com/nordea/oss/copybook/CopyBookSerializer.java
// public class CopyBookSerializer {
//     private CopyBookMapper serializer;
// 
//     public CopyBookSerializer(Class<?> type) {
//         this(type, false);
//     }
// 
//     public CopyBookSerializer(Class<?> type, boolean debug) {
//         this(type, null, debug);
//     }
// 
//     public CopyBookSerializer(Class<?> type, Class<CopyBookMapper> mapper, boolean debug) {
//         CopyBookParser parser = new CopyBookParser(type, debug);
//         try {
//             if(mapper != null) {
//                 serializer = mapper.getDeclaredConstructor().newInstance();
// 
//             } else {
//                 serializer = parser.getSerializerClass().getDeclaredConstructor().newInstance();
//             }
//             serializer.initialize(parser.getConfig());
// 
//         } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
//             throw new CopyBookException("Failed to load Serialization class("+ parser.getSerializerClass().getSimpleName() +")", e);
//         }
//     }
// 
//     public <T> byte[] serialize(T obj) {
//         return serializer.serialize(obj);
//     }
// 
//     public <T> T deserialize(byte[] bytes, Class<T> type) {
//         return serializer.deserialize(bytes, type);
//     }
// 
//     public <T> T deserialize(InputStream inputStream, Class<T> type) throws IOException {
//         return deserialize(ByteUtils.toByteArray(inputStream), type);
//     }
// 
//     public List<CopyBookException> getErrors() {
//         return null; // TODO: Implement depending on errorValue
//     }
// 
//     public int getMinRecordSize() {
//         return serializer.getMinRecordSize();
//     }
// 
//     public int getMaxRecordSize() {
//         return serializer.getMaxRecordSize();
//     }
// 
// }
// 
// Path: copybook4java/src/main/java/com/nordea/oss/copybook/exceptions/CopyBookException.java
// public class CopyBookException extends RuntimeException {
//     private static final long serialVersionUID = 28118369047109260L;
//     public CopyBookException(String message) {
//         super(message);
//     }
// 
//     public CopyBookException(String message, TypeConverterException ex) {
//         super(message + ": " + ex.getClass().getSimpleName() + " :" + ex.getMessage());
//     }
// 
//     public CopyBookException(String message, Exception ex) {
//         super(message + ": " + ex.getClass().getSimpleName() + " :" + ex.getMessage());
//     }
// }


import com.nordea.oss.copybook.CopyBookSerializer;
import com.nordea.oss.copybook.annotations.CopyBook;
import com.nordea.oss.copybook.annotations.CopyBookLine;
import com.nordea.oss.copybook.exceptions.CopyBookException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static org.junit.Assert.assertEquals;
        RequestTest requestTest = new RequestTest();
        requestTest.hellos = new RequestMessage[] { null };
        requestTest.hellos_count = requestTest.hellos.length;

        // Serializer and Deserializer object to and from bytes
        CopyBookSerializer requestTestSerializer = new CopyBookSerializer(RequestTest.class);
        byte[] bytes = requestTestSerializer.serialize(requestTest);
        RequestTest requestTest1 = requestTestSerializer.deserialize(bytes, RequestTest.class);

        assertEquals(0, requestTest1.args.length);
    }

    @Test
    public void testSerializeDeserializeEmptyList() throws Exception {
        // Build test object
        RequestTest requestTest = new RequestTest();
        requestTest.messages = new RequestMessage[] {};
        requestTest.args = new String[]{};

        // Serializer and Deserializer object to and from bytes
        CopyBookSerializer requestTestSerializer = new CopyBookSerializer(RequestTest.class);
        byte[] bytes = requestTestSerializer.serialize(requestTest);
        RequestTest requestTest1 = requestTestSerializer.deserialize(bytes, RequestTest.class);

        assertEquals(0, requestTest1.args.length);
        assertEquals(0, requestTest1.messages.length);
    }

    @org.junit.Test
    public void testSerializeDeserializeSeparatorByteException() throws Exception {
// Path: copybook4java/src/main/java/com/nordea/oss/copybook/CopyBookSerializer.java
// public class CopyBookSerializer {
//     private CopyBookMapper serializer;
// 
//     public CopyBookSerializer(Class<?> type) {
//         this(type, false);
//     }
// 
//     public CopyBookSerializer(Class<?> type, boolean debug) {
//         this(type, null, debug);
//     }
// 
//     public CopyBookSerializer(Class<?> type, Class<CopyBookMapper> mapper, boolean debug) {
//         CopyBookParser parser = new CopyBookParser(type, debug);
//         try {
//             if(mapper != null) {
//                 serializer = mapper.getDeclaredConstructor().newInstance();
// 
//             } else {
//                 serializer = parser.getSerializerClass().getDeclaredConstructor().newInstance();
//             }
//             serializer.initialize(parser.getConfig());
// 
//         } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
//             throw new CopyBookException("Failed to load Serialization class("+ parser.getSerializerClass().getSimpleName() +")", e);
//         }
//     }
// 
//     public <T> byte[] serialize(T obj) {
//         return serializer.serialize(obj);
//     }
// 
//     public <T> T deserialize(byte[] bytes, Class<T> type) {
//         return serializer.deserialize(bytes, type);
//     }
// 
//     public <T> T deserialize(InputStream inputStream, Class<T> type) throws IOException {
//         return deserialize(ByteUtils.toByteArray(inputStream), type);
//     }
// 
//     public List<CopyBookException> getErrors() {
//         return null; // TODO: Implement depending on errorValue
//     }
// 
//     public int getMinRecordSize() {
//         return serializer.getMinRecordSize();
//     }
// 
//     public int getMaxRecordSize() {
//         return serializer.getMaxRecordSize();
//     }
// 
// }
// 
// Path: copybook4java/src/main/java/com/nordea/oss/copybook/exceptions/CopyBookException.java
// public class CopyBookException extends RuntimeException {
//     private static final long serialVersionUID = 28118369047109260L;
//     public CopyBookException(String message) {
//         super(message);
//     }
// 
//     public CopyBookException(String message, TypeConverterException ex) {
//         super(message + ": " + ex.getClass().getSimpleName() + " :" + ex.getMessage());
//     }
// 
//     public CopyBookException(String message, Exception ex) {
//         super(message + ": " + ex.getClass().getSimpleName() + " :" + ex.getMessage());
//     }
// }


// Path: copybook4java/src/test/java/com/nordea/oss/copybook/serializers/CopyBookMapperPackedFirstLevelTest.java
import com.nordea.oss.copybook.CopyBookSerializer;
import com.nordea.oss.copybook.annotations.CopyBook;
import com.nordea.oss.copybook.annotations.CopyBookLine;
import com.nordea.oss.copybook.exceptions.CopyBookException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static org.junit.Assert.assertEquals;

        RequestTest requestTest = new RequestTest();
        requestTest.hellos = new RequestMessage[] { null };
        requestTest.hellos_count = requestTest.hellos.length;

        // Serializer and Deserializer object to and from bytes
        CopyBookSerializer requestTestSerializer = new CopyBookSerializer(RequestTest.class);
        byte[] bytes = requestTestSerializer.serialize(requestTest);
        RequestTest requestTest1 = requestTestSerializer.deserialize(bytes, RequestTest.class);

        assertEquals(0, requestTest1.args.length);
    }

    @Test
    public void testSerializeDeserializeEmptyList() throws Exception {
        // Build test object
        RequestTest requestTest = new RequestTest();
        requestTest.messages = new RequestMessage[] {};
        requestTest.args = new String[]{};

        // Serializer and Deserializer object to and from bytes
        CopyBookSerializer requestTestSerializer = new CopyBookSerializer(RequestTest.class);
        byte[] bytes = requestTestSerializer.serialize(requestTest);
        RequestTest requestTest1 = requestTestSerializer.deserialize(bytes, RequestTest.class);

        assertEquals(0, requestTest1.args.length);
        assertEquals(0, requestTest1.messages.length);
    }

    @org.junit.Test
    public void testSerializeDeserializeSeparatorByteException() throws Exception {
        expectedEx.expect(CopyBookException.class);