Index: /trunk/src/org/openstreetmap/josm/actions/JosmAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/JosmAction.java	(revision 9593)
+++ /trunk/src/org/openstreetmap/josm/actions/JosmAction.java	(revision 9594)
@@ -213,9 +213,9 @@
 
     /**
-     * Replies the current dataset
+     * Replies the current dataset.
      *
      * @return the current dataset. null, if no current dataset exists
      */
-    protected static DataSet getCurrentDataSet() {
+    public static DataSet getCurrentDataSet() {
         return Main.main != null ? Main.main.getCurrentDataSet() : null;
     }
Index: /trunk/src/org/openstreetmap/josm/actions/SelectByInternalPointAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/SelectByInternalPointAction.java	(revision 9593)
+++ /trunk/src/org/openstreetmap/josm/actions/SelectByInternalPointAction.java	(revision 9594)
@@ -2,5 +2,4 @@
 package org.openstreetmap.josm.actions;
 
-import java.awt.event.ActionEvent;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -24,5 +23,9 @@
  * @since 7144
  */
-public class SelectByInternalPointAction extends JosmAction {
+public final class SelectByInternalPointAction {
+
+    private SelectByInternalPointAction() {
+        // Hide public constructor for utility class
+    }
 
     /**
@@ -35,5 +38,5 @@
      */
     public static Collection<OsmPrimitive> getSurroundingObjects(EastNorth internalPoint) {
-        final DataSet ds = getCurrentDataSet();
+        final DataSet ds = JosmAction.getCurrentDataSet();
         if (ds == null) {
             return Collections.emptySet();
@@ -42,26 +45,21 @@
         final Map<Double, OsmPrimitive> found = new TreeMap<>();
         for (Way w : ds.getWays()) {
-            if (w.isUsable() && w.isClosed() && w.isSelectable()) {
-                if (Geometry.nodeInsidePolygon(n, w.getNodes())) {
-                    found.put(Geometry.closedWayArea(w), w);
-                }
+            if (w.isUsable() && w.isClosed() && w.isSelectable() && Geometry.nodeInsidePolygon(n, w.getNodes())) {
+                found.put(Geometry.closedWayArea(w), w);
             }
         }
         for (Relation r : ds.getRelations()) {
-            if (r.isUsable() && r.isMultipolygon() && r.isSelectable()) {
-                if (Geometry.isNodeInsideMultiPolygon(n, r, null)) {
-                    for (RelationMember m : r.getMembers()) {
-                        if (m.isWay() && m.getWay().isClosed()) {
-                            found.values().remove(m.getWay());
-                        }
+            if (r.isUsable() && r.isMultipolygon() && r.isSelectable() && Geometry.isNodeInsideMultiPolygon(n, r, null)) {
+                for (RelationMember m : r.getMembers()) {
+                    if (m.isWay() && m.getWay().isClosed()) {
+                        found.values().remove(m.getWay());
                     }
-                    // estimate multipolygon size by its bounding box area
-                    BBox bBox = r.getBBox();
-                    EastNorth en1 = Main.map.mapView.getProjection().latlon2eastNorth(bBox.getTopLeft());
-                    EastNorth en2 = Main.map.mapView.getProjection().latlon2eastNorth(bBox.getBottomRight());
-                    double s = Math.abs((en1.east() - en2.east()) * (en1.north() - en2.north()));
-                    if (s == 0) s = 1e8;
-                    found.put(s, r);
                 }
+                // estimate multipolygon size by its bounding box area
+                BBox bBox = r.getBBox();
+                EastNorth en1 = Main.map.mapView.getProjection().latlon2eastNorth(bBox.getTopLeft());
+                EastNorth en2 = Main.map.mapView.getProjection().latlon2eastNorth(bBox.getBottomRight());
+                double s = Math.abs((en1.east() - en2.east()) * (en1.north() - en2.north()));
+                found.put(s <= 0 ? 1e8 : s, r);
             }
         }
@@ -89,22 +87,18 @@
     public static void performSelection(EastNorth internalPoint, boolean doAdd, boolean doRemove) {
         final Collection<OsmPrimitive> surroundingObjects = getSurroundingObjects(internalPoint);
+        final DataSet ds = JosmAction.getCurrentDataSet();
         if (surroundingObjects.isEmpty()) {
             return;
         } else if (doRemove) {
-            final Collection<OsmPrimitive> newSelection = new ArrayList<>(getCurrentDataSet().getSelected());
+            final Collection<OsmPrimitive> newSelection = new ArrayList<>(ds.getSelected());
             newSelection.removeAll(surroundingObjects);
-            getCurrentDataSet().setSelected(newSelection);
+            ds.setSelected(newSelection);
         } else if (doAdd) {
-            final Collection<OsmPrimitive> newSelection = new ArrayList<>(getCurrentDataSet().getSelected());
+            final Collection<OsmPrimitive> newSelection = new ArrayList<>(ds.getSelected());
             newSelection.add(surroundingObjects.iterator().next());
-            getCurrentDataSet().setSelected(newSelection);
+            ds.setSelected(newSelection);
         } else {
-            getCurrentDataSet().setSelected(surroundingObjects.iterator().next());
+            ds.setSelected(surroundingObjects.iterator().next());
         }
     }
-
-    @Override
-    public void actionPerformed(ActionEvent e) {
-        throw new UnsupportedOperationException();
-    }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java	(revision 9594)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java	(revision 9594)
@@ -0,0 +1,124 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.actions;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.RelationMember;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.layer.Layer;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+
+/**
+ * Unit tests for class {@link SelectByInternalPointAction}.
+ */
+public final class SelectByInternalPointActionTest {
+
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void setUp() {
+        JOSMFixture.createUnitTestFixture().init(true);
+    }
+
+    /**
+     * Unit test - no dataset.
+     */
+    @Test
+    public void testNoDataSet() {
+        while (Main.main.hasEditLayer()) {
+            Main.main.removeLayer(Main.main.getEditLayer());
+        }
+        assertNull(JosmAction.getCurrentDataSet());
+        assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(null).size());
+        assertNull(SelectByInternalPointAction.getSmallestSurroundingObject(null));
+        SelectByInternalPointAction.performSelection(null, false, false);
+    }
+
+    private static Layer initDataSet() {
+        DataSet ds = new DataSet();
+        Node n1 = new Node(new EastNorth(1, 1));
+        Node n2 = new Node(new EastNorth(1, 2));
+        Node n3 = new Node(new EastNorth(2, 2));
+        Node n4 = new Node(new EastNorth(2, 1));
+        ds.addPrimitive(n1);
+        ds.addPrimitive(n2);
+        ds.addPrimitive(n3);
+        ds.addPrimitive(n4);
+        Way w = new Way();
+        w.addNode(n1);
+        w.addNode(n2);
+        w.addNode(n3);
+        w.addNode(n4);
+        w.addNode(n1);
+        assertTrue(w.isClosed());
+        ds.addPrimitive(w);
+        Relation r = new Relation();
+        r.addMember(new RelationMember("outer", w));
+        ds.addPrimitive(r);
+        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
+        Main.main.addLayer(layer);
+        return layer;
+    }
+
+    /**
+     * Unit test of {@link SelectByInternalPointAction#getSurroundingObjects} method.
+     */
+    @Test
+    public void testGetSurroundingObjects() {
+        Layer layer = initDataSet();
+        assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(null).size());
+        assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(new EastNorth(0, 0)).size());
+        assertEquals(1, SelectByInternalPointAction.getSurroundingObjects(new EastNorth(1.5, 1.5)).size());
+        assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(new EastNorth(3, 3)).size());
+        Main.main.removeLayer(layer);
+    }
+
+    /**
+     * Unit test of {@link SelectByInternalPointAction#getSmallestSurroundingObject} method.
+     */
+    @Test
+    public void testGetSmallestSurroundingObject() {
+        Layer layer = initDataSet();
+        assertNull(SelectByInternalPointAction.getSmallestSurroundingObject(null));
+        assertNotNull(SelectByInternalPointAction.getSmallestSurroundingObject(new EastNorth(1.5, 1.5)));
+        Main.main.removeLayer(layer);
+    }
+
+    /**
+     * Unit test of {@link SelectByInternalPointAction#performSelection} method.
+     */
+    @Test
+    public void testPerformSelection() {
+        Layer layer = initDataSet();
+        DataSet ds = JosmAction.getCurrentDataSet();
+
+        assertEquals(0, ds.getSelected().size());
+        SelectByInternalPointAction.performSelection(null, false, false);
+        assertEquals(0, ds.getSelected().size());
+        SelectByInternalPointAction.performSelection(new EastNorth(0, 0), false, false);
+        assertEquals(0, ds.getSelected().size());
+        SelectByInternalPointAction.performSelection(new EastNorth(1.5, 1.5), false, false);
+        assertEquals(1, ds.getSelected().size());
+        ds.clearSelection();
+        ds.addSelected(ds.getNodes());
+        assertEquals(4, ds.getSelected().size());
+        SelectByInternalPointAction.performSelection(new EastNorth(1.5, 1.5), true, false);
+        assertEquals(5, ds.getSelected().size());
+        SelectByInternalPointAction.performSelection(new EastNorth(1.5, 1.5), false, true);
+        assertEquals(4, ds.getSelected().size());
+
+        Main.main.removeLayer(layer);
+    }
+}
