@Test
public void testRemoveRoadSegment() {

	// Remove the segments
	assertTrue(this.network.removeRoadSegment(this.segment4));
	assertTrue(this.network.removeRoadSegment(this.segment6));
	// Check the network segment list
	assertEquals(7, this.network.getSegmentCount());
	Collection<RoadSegmentStub> expectedList = new ArrayList<>();
	Collections.addAll(expectedList,
			this.segment1, this.segment2, this.segment3, this.segment5,
			this.segment7, this.segment8, this.segment9);
	for(RoadSegment segment : this.network) {
		assertTrue(expectedList.contains(segment));
		expectedList.remove(segment);
	}
	assertTrue(expectedList.isEmpty());
	Collections.addAll(expectedList,
			this.segment1, this.segment2, this.segment3, this.segment5,
			this.segment7, this.segment8, this.segment9);
	for(RoadSegment segment : this.network.getRoadSegments()) {
		assertTrue(expectedList.contains(segment));
		expectedList.remove(segment);
	}
	assertTrue(expectedList.isEmpty());
	// Check the network connections
	assertEquals(new Point2d(0.,0.), this.segment1.getFirstPoint());
	assertEquals(this.segment1.getLastPoint(),this.segment2.getLastPoint());
	assertEquals(this.segment2.getFirstPoint(),this.segment3.getFirstPoint());
	assertEquals(this.segment2.getFirstPoint(),this.segment5.getFirstPoint());
	assertEquals(this.segment2.getFirstPoint(),this.segment7.getFirstPoint());
	assertEquals(this.segment2.getFirstPoint(),this.segment8.getLastPoint());
	assertEquals(this.segment2.getFirstPoint(),this.segment9.getLastPoint());
	assertEquals(this.segment2.getLastPoint(),this.segment1.getLastPoint());
	assertEquals(this.segment3.getFirstPoint(),this.segment2.getFirstPoint());
	assertEquals(this.segment3.getFirstPoint(),this.segment5.getFirstPoint());
	assertEquals(this.segment3.getFirstPoint(),this.segment7.getFirstPoint());
	assertEquals(this.segment3.getFirstPoint(),this.segment8.getLastPoint());
	assertEquals(this.segment3.getFirstPoint(),this.segment9.getLastPoint());
	assertEquals(new Point2d(-100.,-300), this.segment3.getLastPoint());
	assertEquals(this.segment5.getFirstPoint(),this.segment2.getFirstPoint());
	assertEquals(this.segment5.getFirstPoint(),this.segment3.getFirstPoint());
	assertEquals(this.segment5.getFirstPoint(),this.segment7.getFirstPoint());
	assertEquals(this.segment5.getFirstPoint(),this.segment8.getLastPoint());
	assertEquals(this.segment5.getFirstPoint(),this.segment9.getLastPoint());
	assertEquals(new Point2d(0.,10.), this.segment5.getLastPoint());
	assertEquals(this.segment7.getFirstPoint(),this.segment2.getFirstPoint());
	assertEquals(this.segment7.getFirstPoint(),this.segment3.getFirstPoint());
	assertEquals(this.segment7.getFirstPoint(),this.segment5.getFirstPoint());
	assertEquals(this.segment7.getFirstPoint(),this.segment8.getLastPoint());
	assertEquals(this.segment7.getFirstPoint(),this.segment9.getLastPoint());
	assertEquals(new Point2d(100.,-10.), this.segment7.getLastPoint());
	assertEquals(new Point2d(170.,7.), this.segment8.getFirstPoint());
	assertEquals(this.segment8.getLastPoint(),this.segment2.getFirstPoint());
	assertEquals(this.segment8.getLastPoint(),this.segment3.getFirstPoint());
	assertEquals(this.segment8.getLastPoint(),this.segment5.getFirstPoint());
	assertEquals(this.segment8.getLastPoint(),this.segment7.getFirstPoint());
	assertEquals(this.segment8.getLastPoint(),this.segment9.getLastPoint());
	assertEquals(new Point2d(120.,100.), this.segment9.getFirstPoint());
	assertEquals(this.segment9.getLastPoint(),this.segment2.getFirstPoint());
	assertEquals(this.segment9.getLastPoint(),this.segment3.getFirstPoint());
	assertEquals(this.segment9.getLastPoint(),this.segment5.getFirstPoint());
	assertEquals(this.segment9.getLastPoint(),this.segment7.getFirstPoint());
	assertEquals(this.segment9.getLastPoint(),this.segment8.getLastPoint());
	// Test invalid calls
	assertFalse(this.network.removeRoadSegment(null));
	assertFalse(this.network.removeRoadSegment(this.segment4));
}