@@ -0,0 +1,1919 @@
+/*%0D%0A *  Copyright the original author or authors.%0D%0A *%0D%0A *  Licensed under the Apache License, Version 2.0 (the %22License%22);%0D%0A *  you may not use this file except in compliance with the License.%0D%0A *  You may obtain a copy of the License at%0D%0A *%0D%0A *      http://www.apache.org/licenses/LICENSE-2.0%0D%0A *%0D%0A *  Unless required by applicable law or agreed to in writing, software%0D%0A *  distributed under the License is distributed on an %22AS IS%22 BASIS,%0D%0A *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0D%0A *  See the License for the specific language governing permissions and%0D%0A *  limitations under the License.%0D%0A */%0D%0Apackage therian.operator.convert;%0D%0A%0D%0Aimport static org.junit.Assert.assertArrayEquals;%0D%0A%0D%0Aimport java.util.Arrays;%0D%0Aimport java.util.LinkedHashSet;%0D%0Aimport java.util.Set;%0D%0A%0D%0Aimport org.junit.Test;%0D%0A%0D%0Aimport therian.TherianModule;%0D%0Aimport therian.operation.Convert;%0D%0Aimport therian.operator.OperatorTest;%0D%0Aimport therian.operator.getelementtype.GetArrayElementType;%0D%0Aimport therian.position.Ref;%0D%0A%0D%0Apublic class CollectionToArrayTest extends OperatorTest %7B%0D%0A%0D%0A    @Override%0D%0A    protected TherianModule module() %7B%0D%0A        return TherianModule.create().withOperators(new CollectionToArray(), new GetArrayElementType());%0D%0A    %7D%0D%0A%0D%0A    @Test%0D%0A    public void test() %7B%0D%0A        final String%5B%5D array = %7B %22foo%22, %22bar%22, %22baz%22 %7D;%0D%0A        assertArrayEquals(array, therianContext.eval(Convert.to(String%5B%5D.class, Ref.to(Arrays.asList(array)))));%0D%0A    %7D%0D%0A%0D%0A    public void testPrimitive() %7B%0D%0A        @SuppressWarnings(%22serial%22)%0D%0A        final Set%3CInteger%3E s = new LinkedHashSet%3CInteger%3E() %7B%0D%0A            %7B%0D%0A                for (int i = 0; i %3C 3; i++) %7B%0D%0A                    add(Integer.valueOf(i));%0D%0A                %7D%0D%0A            %7D%0D%0A        %7D;%0D%0A        assertArrayEquals(new int%5B%5D %7B 0, 1, 2 %7D,%0D%0A            therianContext.eval(Convert.to(int%5B%5D.class, new Ref%3CSet%3CInteger%3E%3E(s) %7B%7D)));%0D%0A    %7D%0D%0A%7D%0D%0A

rework CollectionToArray and test