Index: trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java	(revision 8926)
+++ trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java	(revision 8930)
@@ -1,4 +1,6 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.actions;
+
+import static org.junit.Assert.assertEquals;
 
 import java.io.FileInputStream;
@@ -11,4 +13,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.actions.search.SearchAction;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
@@ -43,3 +46,25 @@
         }
     }
+
+    /**
+     * Non-regression test for bug #11992.
+     * @throws IOException if any I/O error occurs
+     * @throws IllegalDataException if OSM parsing fails
+     */
+    @Test
+    public void testTicket11992() throws IOException, IllegalDataException {
+        try (InputStream is = new FileInputStream(TestUtils.getRegressionDataFile(11992, "shapes.osm"))) {
+            DataSet ds = OsmReader.parseDataSet(is, null);
+            assertEquals(10, ds.getWays().size());
+            Main.map.mapView.addLayer(new OsmDataLayer(ds, null, null));
+            for (String ref : new String[]{"A", "B", "C", "D", "E"}) {
+                System.out.print("Joining ways " + ref);
+                SearchAction.search("type:way ref="+ref, SearchAction.SearchMode.replace);
+                assertEquals(2, ds.getSelectedWays().size());
+                Main.main.menu.joinAreas.join(ds.getSelectedWays());
+                assertEquals(1, ds.getSelectedWays().size());
+                System.out.println(" ==> OK");
+            }
+        }
+    }
 }
