001package ch.qos.logback.core.util; 002 003import static org.junit.Assert.*; 004 005import org.junit.After; 006import org.junit.Before; 007import org.junit.Test; 008 009public class COWArrayListTest { 010 011 Integer[] model = new Integer[0]; 012 COWArrayList<Integer> cowaList = new COWArrayList<Integer>(model); 013 014 @Before 015 public void setUp() throws Exception { 016 } 017 018 @After 019 public void tearDown() throws Exception { 020 } 021 022 @Test 023 public void basicToArray() { 024 cowaList.add(1); 025 Object[] result = cowaList.toArray(); 026 assertArrayEquals(new Integer[] { 1 }, result); 027 } 028 029 @Test 030 public void basicToArrayWithModel() { 031 cowaList.add(1); 032 Integer[] result = cowaList.toArray(model); 033 assertArrayEquals(new Integer[] { 1 }, result); 034 } 035 036 037 @Test 038 public void basicToArrayTyped() { 039 cowaList.add(1); 040 Integer[] result = cowaList.asTypedArray(); 041 assertArrayEquals(new Integer[] { 1 }, result); 042 } 043 044}