1   /*
2    * Licensed under the Apache License, Version 2.0 (the "License");
3    * you may not use this file except in compliance with the License.
4    * You may obtain a copy of the License at
5    *
6    *     http://www.apache.org/licenses/LICENSE-2.0
7    *
8    * Unless required by applicable law or agreed to in writing, software
9    * distributed under the License is distributed on an
10   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
11   * either express or implied. See the License for the specific language
12   * governing permissions and limitations under the License.
13   */
14  package fuzzy.internal.functions;
15  
16  import static org.junit.Assert.assertTrue;
17  
18  import java.util.Arrays;
19  import java.util.Collection;
20  
21  import org.junit.Test;
22  
23  /**
24   * Tests for Doubles utility class.
25   *
26   * @since 0.2
27   * @see Doubles
28   */
29  public class TestDoubles {
30  
31  	@Test
32  	public void testDoubles() {
33  		Collection<Double> list = Arrays.asList(-1.0, 1.0, 2.0, 3.5);
34  		assertTrue(Arrays.equals(new double[]{-1.0, 1.0, 2.0, 3.5}, Doubles.toArray(list)));
35  	}
36  
37  	@Test
38      public void testDoublesEmpty() {
39          Collection<Double> list = Arrays.asList();
40          assertTrue(Arrays.equals(new double[0], Doubles.toArray(list)));
41      }
42  
43  }