// 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();
//     }
// 
// }


import com.nordea.oss.copybook.CopyBookSerializer;
import com.nordea.oss.copybook.annotations.CopyBook;
import com.nordea.oss.copybook.annotations.CopyBookLine;
import java.math.BigDecimal;
import static org.junit.Assert.assertArrayEquals;
/*
 * Copyright (c) 2015. Troels Liebe Bentsen <tlb@nversion.dk>
 * Copyright (c) 2016. Nordea Bank AB
 * Licensed under the MIT license (LICENSE.txt)
 */

package com.nordea.oss.copybook.serializers;




public class CopyBookMapperFullOccursPicSingleLineTest {

    @CopyBook(type = FullMapper.class)
    static public class StringFieldOccursTwoTimes {
        @CopyBookLine("01 FIELDS OCCURS 2 TIMES PIC X(4).")
        public String[] fields;
    }

    @CopyBook(type = FullMapper.class)
    static public class IntFieldOccursTwoTimes {
        @CopyBookLine("01 FIELDS OCCURS 2 TIMES PIC 9(4).")
        public int[] fields;
    }

    @CopyBook(type = FullMapper.class)
    static public class SignedIntFieldOccursTwoTimes {
        @CopyBookLine("01 FIELDS OCCURS 2 TIMES PIC S9(4).")
        public int[] fields;
    }

    @CopyBook(type = FullMapper.class)
    static public class DecimalFieldOccursTwoTimes {
        @CopyBookLine("01 FIELDS OCCURS 2 TIMES PIC 9(3)V9(2).")
        public BigDecimal[] fields;
    }

    @CopyBook(type = FullMapper.class)
    static public class SignedDecimalFieldOccursTwoTimes {
        @CopyBookLine("01 FIELDS OCCURS 2 TIMES PIC S9(3)V9(2).")
        public BigDecimal[] fields;
    }

    @org.junit.Test
      public void testStringFieldOccursTwoTimes() 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/test/java/com/nordea/oss/copybook/serializers/CopyBookMapperFullOccursPicSingleLineTest.java
import com.nordea.oss.copybook.CopyBookSerializer;
import com.nordea.oss.copybook.annotations.CopyBook;
import com.nordea.oss.copybook.annotations.CopyBookLine;
import java.math.BigDecimal;
import static org.junit.Assert.assertArrayEquals;

/*
 * Copyright (c) 2015. Troels Liebe Bentsen <tlb@nversion.dk>
 * Copyright (c) 2016. Nordea Bank AB
 * Licensed under the MIT license (LICENSE.txt)
 */

package com.nordea.oss.copybook.serializers;




public class CopyBookMapperFullOccursPicSingleLineTest {

    @CopyBook(type = FullMapper.class)
    static public class StringFieldOccursTwoTimes {
        @CopyBookLine("01 FIELDS OCCURS 2 TIMES PIC X(4).")
        public String[] fields;
    }

    @CopyBook(type = FullMapper.class)
    static public class IntFieldOccursTwoTimes {
        @CopyBookLine("01 FIELDS OCCURS 2 TIMES PIC 9(4).")
        public int[] fields;
    }

    @CopyBook(type = FullMapper.class)
    static public class SignedIntFieldOccursTwoTimes {
        @CopyBookLine("01 FIELDS OCCURS 2 TIMES PIC S9(4).")
        public int[] fields;
    }

    @CopyBook(type = FullMapper.class)
    static public class DecimalFieldOccursTwoTimes {
        @CopyBookLine("01 FIELDS OCCURS 2 TIMES PIC 9(3)V9(2).")
        public BigDecimal[] fields;
    }

    @CopyBook(type = FullMapper.class)
    static public class SignedDecimalFieldOccursTwoTimes {
        @CopyBookLine("01 FIELDS OCCURS 2 TIMES PIC S9(3)V9(2).")
        public BigDecimal[] fields;
    }

    @org.junit.Test
      public void testStringFieldOccursTwoTimes() throws Exception {
        CopyBookSerializer serializer = new CopyBookSerializer(StringFieldOccursTwoTimes.class);