Index: /trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java	(revision 18961)
+++ /trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java	(revision 18962)
@@ -310,30 +310,5 @@
     @Override
     public void endTest() {
-        final Collection<Way> selection;
-        if (this instanceof SelfCrossing || !partialSelection) {
-            selection = waysToTest;
-        } else {
-            selection = new HashSet<>();
-            DataSet ds = OsmDataManager.getInstance().getActiveDataSet();
-            if (ds != null) {
-                for (Way wt : waysToTest) {
-                    selection.addAll(ds.searchWays(wt.getBBox()).stream()
-                            .filter(w -> !w.isDeleted() && isPrimitiveUsable(w)).collect(Collectors.toList()));
-                    if (this instanceof CrossingWays.Boundaries) {
-                        List<Relation> relations = ds.searchRelations(wt.getBBox()).stream()
-                                .filter(p -> isPrimitiveUsable(p)).collect(Collectors.toList());
-                        for (Relation r: relations) {
-                            for (Way w : r.getMemberPrimitives(Way.class)) {
-                                if (!w.isIncomplete())
-                                    selection.add(w);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        for (Way w : selection) {
-            testWay(w);
-        }
+        runTest();
         // free storage
         cellSegments.clear();
@@ -345,4 +320,38 @@
     }
 
+    protected void runTest() {
+        final Collection<Way> selection;
+        if (this instanceof SelfCrossing || !partialSelection) {
+            selection = waysToTest;
+        } else {
+            selection = addNearbyObjects();
+        }
+        for (Way w : selection) {
+            testWay(w);
+        }
+
+    }
+
+    private Collection<Way> addNearbyObjects() {
+        final Collection<Way> selection = new HashSet<>();
+        DataSet ds = OsmDataManager.getInstance().getActiveDataSet();
+        if (ds != null) {
+            for (Way wt : waysToTest) {
+                selection.addAll(ds.searchWays(wt.getBBox()).stream()
+                        .filter(w -> !w.isDeleted() && isPrimitiveUsable(w)).collect(Collectors.toList()));
+                if (this instanceof CrossingWays.Boundaries) {
+                    List<Relation> relations = ds.searchRelations(wt.getBBox()).stream()
+                            .filter(p -> isPrimitiveUsable(p)).collect(Collectors.toList());
+                    for (Relation r: relations) {
+                        for (Way w : r.getMemberPrimitives(Way.class)) {
+                            if (!w.isIncomplete())
+                                selection.add(w);
+                        }
+                    }
+                }
+            }
+        }
+        return selection;
+    }
     static boolean isCoastline(OsmPrimitive w) {
         return w.hasTag("natural", "water", "coastline") || w.hasTag(LANDUSE, "reservoir");
@@ -521,5 +530,5 @@
         SelfCrossing test = new SelfCrossing();
         test.visit(way);
-        test.endTest();
+        test.runTest();
         return !test.getErrors().isEmpty();
     }
