### Question:
AggregatedSegment { public Collection<ConnectableNode> getEndpointNodes() { Collection<ConnectableNode> nodes = new ArrayList<ConnectableNode>(); for (ConnectableSegment segment : segments) nodes.add(segment.getEndpointNodes()); return nodes; } AggregatedSegment(ConnectableSegment segment);  AggregatedSegment(AggregatedSegment aggregatedSegment); Collection<ConnectableNode> getEndpointNodes(); void addSegment(AggregatedSegment segment); void addAllSegments(Collection<ConnectableSegment> segments); List<ConnectableSegment> getSegments();  }### Answer:
@Test public void testGetEndpointNodes() throws Exception { AggregatedSegment segment = new AggregatedSegment(TestUtils.asFixedOrderWay(1, 2, 3, 4)); Collection<ConnectableNode> endpointNodes = segment.getEndpointNodes(); TestUtils.assertContainsNodeIds(endpointNodes, 1, 2, 3, 4); }