PathUtils { public static int getLength(final List<Line> path, final Line start, final Line end) { if (path == null || path.isEmpty()) { return 0; } int posStart = path.indexOf(start); int posEnd = path.indexOf(end); if (posStart < 0 || posEnd < 0 || posEnd < posStart) { return -1; } int length = 0; int i = posStart; while (i <= posEnd) { length += path.get(i).getLineLength(); i++; } return length; } private  PathUtils(); static int getLength(final List<Line> path, final Line start,
                                final Line end); static int getLength(final List<Line> path); static boolean checkPathConnection(final List<Line> path); static List<Line> constructPath(final LineLinkedListElement dest); static LineLinkedListElement findElementInQueue(
            final Queue<? extends LineLinkedListElement> pq, final Line line); static Line findCommonLineInPaths(final List<? extends Line> location,
                                             final LineLinkedListElement el);  }
@Test public final void testGetLength1() { assertEquals(PathUtils.getLength(path), PATH_LENGTH); assertEquals(PathUtils.getLength(emptyPath), 0); assertEquals(PathUtils.getLength(null), 0); }
@Test public final void testGetLength2() { assertEquals(PathUtils.getLength(path, path.get(0), path.get(path .size() - 1)), PATH_LENGTH); assertEquals(PathUtils.getLength(path, null, null), RETURN_CODE_MINUS_ONE); assertEquals(PathUtils.getLength(null, null, null), 0); assertEquals(PathUtils.getLength(emptyPath, null, null), 0); assertEquals(PathUtils.getLength(path, path.get(path.size() - 1), path .get(0)), RETURN_CODE_MINUS_ONE); assertEquals(PathUtils.getLength(path, path.get(0), null), RETURN_CODE_MINUS_ONE); assertEquals(PathUtils.getLength(path, null, path.get(0)), RETURN_CODE_MINUS_ONE); }