1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.geometry.euclidean.twod;
18
19 import java.util.Collections;
20 import java.util.List;
21
22 import org.apache.commons.numbers.core.Precision;
23 import org.junit.jupiter.api.Assertions;
24 import org.junit.jupiter.api.Test;
25
26 class BoundaryList2DTest {
27
28 private static final double TEST_EPS = 1e-10;
29
30 private static final Precision.DoubleEquivalence TEST_PRECISION =
31 Precision.doubleEquivalenceOfEpsilon(TEST_EPS);
32
33 @Test
34 void testCtor() {
35
36 final List<LineConvexSubset> boundaries = Collections.singletonList(
37 Lines.segmentFromPoints(Vector2D.ZERO, Vector2D.of(1, 1), TEST_PRECISION)
38 );
39
40
41 final BoundaryList2D list = new BoundaryList2D(boundaries);
42
43
44 Assertions.assertNotSame(boundaries, list.getBoundaries());
45 Assertions.assertEquals(boundaries, list.getBoundaries());
46 Assertions.assertEquals(1, list.count());
47 }
48
49 @Test
50 void testToList() {
51
52 final BoundaryList2D list = new BoundaryList2D(Collections.emptyList());
53
54
55 Assertions.assertSame(list, list.toList());
56 }
57
58 @Test
59 void testToString() {
60
61 final BoundaryList2D list = new BoundaryList2D(Collections.emptyList());
62
63
64 Assertions.assertEquals("BoundaryList2D[count= 0]", list.toString());
65 }
66 }