@@ -0,0 +1,2391 @@
+/*%0A * Copyright (C) 2008 feilong%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *         http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.feilong.core.util.aggregateutiltest;%0A%0Aimport static java.util.Collections.emptyMap;%0Aimport static org.hamcrest.Matchers.allOf;%0Aimport static org.hamcrest.Matchers.hasEntry;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertThat;%0A%0Aimport java.math.BigDecimal;%0Aimport java.util.Map;%0A%0Aimport org.junit.Test;%0A%0Aimport com.feilong.core.util.AggregateUtil;%0Aimport com.feilong.test.User;%0A%0Aimport static com.feilong.core.bean.ConvertUtil.toBigDecimal;%0Aimport static com.feilong.core.bean.ConvertUtil.toList;%0A%0Apublic class AggregateUtilSumArrayTest%7B%0A%0A    //*************AggregateUtil.sum(Collection%3CUser%3E, String...)*******************************%0A    /**%0A     * Test sum2.%0A     */%0A    @Test%0A    public void testSum2()%7B%0A        User user1 = new User(2L);%0A        user1.setAge(18);%0A%0A        User user2 = new User(3L);%0A        user2.setAge(30);%0A%0A        Map%3CString, BigDecimal%3E map = AggregateUtil.sum(toList(user1, user2), %22id%22, %22age%22);%0A        assertThat(map, allOf(hasEntry(%22id%22, toBigDecimal(5)), hasEntry(%22age%22, toBigDecimal(48))));%0A    %7D%0A%0A    @Test%0A    public void testSumNullCollection()%7B%0A        assertEquals(emptyMap(), AggregateUtil.sum(null, %22id%22, %22age%22));%0A    %7D%0A%0A    @Test%0A    public void testSumEmptyCollection()%7B%0A        assertEquals(emptyMap(), AggregateUtil.sum(toList(), %22id%22, %22age%22));%0A    %7D%0A%0A    @Test(expected = NullPointerException.class)%0A    public void testSumNullPropertyNames()%7B%0A        User user = new User(2L);%0A        user.setAge(18);%0A        AggregateUtil.sum(toList(user), (String%5B%5D) null);%0A    %7D%0A%0A    @Test(expected = IllegalArgumentException.class)%0A    public void testSumNullPropertyNamesElement()%7B%0A        User user = new User(2L);%0A        user.setAge(18);%0A        AggregateUtil.sum(toList(user), %22id%22, (String) null);%0A    %7D%0A%7D%0A

add AggregateUtilSumArrayTest fix #344