package ma.glasnost.orika.test.array;

import ma.glasnost.orika.MapperFacade;
import ma.glasnost.orika.test.MappingUtil;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

import java.util.Arrays;

public class ArrayTestCase {

    @Test
    public void testSimplePrimitiveArray() {
        ArrayTestCaseClasses.A source =  new ArrayTestCaseClasses.A();
        byte[] buffer = new byte[]{1,2,3,4};
        source.setBuffer(buffer);

        MapperFacade mapperFacade = MappingUtil.getMapperFactory().getMapperFacade();

        ArrayTestCaseClasses.B destination = mapperFacade.map(source, ArrayTestCaseClasses.B.class);

        Assert.assertArrayEquals(source.getBuffer(), destination.getBuffer());
        
    }

    @Test
    @Ignore
    public void testSimplePrimitiveToWrapperArray() {
        ArrayTestCaseClasses.A source =  new ArrayTestCaseClasses.A();
        byte[] buffer = new byte[]{1,2,3,4};
        source.setBuffer(buffer);

        MapperFacade mapperFacade = MappingUtil.getMapperFactory().getMapperFacade();

        ArrayTestCaseClasses.C destination = mapperFacade.map(source, ArrayTestCaseClasses.C.class);

        Assert.assertArrayEquals(new Byte[]{1,2,3,4}, destination.getBuffer());
    }
}

@@ -775,21 +775,8 @@
 st%0D%0A
-    @Ignore%0D%0A
     
@@ -818,32 +818,32 @@
 apperArray() %7B%0D%0A
+
         ArrayTes
@@ -1166,32 +1166,32 @@
 es.C.class);%0D%0A%0D%0A
-
         Assert.a
@@ -1262,11 +1262,531 @@
 %0A    %7D%0D%0A
+    %0D%0A    @Test%0D%0A    public void testArrayToList() %7B%0D%0A    %09MapperFacade mapperFacade = MappingUtil.getMapperFactory().getMapperFacade();%0D%0A    %09%0D%0A    %09ArrayTestCaseClasses.A source =  new ArrayTestCaseClasses.A();%0D%0A        byte%5B%5D buffer = new byte%5B%5D%7B1,2,3,4%7D;%0D%0A        source.setBuffer(buffer);%0D%0A%0D%0A%0D%0A        ArrayTestCaseClasses.D destination = mapperFacade.map(source, ArrayTestCaseClasses.D.class);%0D%0A%0D%0A        Assert.assertEquals(Arrays.asList((byte)1,(byte)2,(byte)3,(byte)4), destination.getBuffer());%0D%0A    %09%0D%0A    %7D%0D%0A
 %7D%0D%0A

Fix bug related to mapping Array to Collection