Index: trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java	(revision 15555)
+++ trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java	(revision 15558)
@@ -4,7 +4,10 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
@@ -18,4 +21,5 @@
 import org.openstreetmap.josm.data.osm.NodeGraph;
 import org.openstreetmap.josm.data.osm.NodePair;
+import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
@@ -60,5 +64,5 @@
 
     /**
-     * Non-regression test for bug #1835 (combine way with overlapping ways)
+     * Non-regression test for bug #18385 (combine way with overlapping ways)
      * @throws IOException if any I/O error occurs
      * @throws IllegalDataException if OSM parsing fails
@@ -75,4 +79,23 @@
 
     /**
+     * Non-regression test for bug #18387 (combine new way with oneway)
+     * @throws IOException if any I/O error occurs
+     * @throws IllegalDataException if OSM parsing fails
+     */
+    @Test
+    public void testTicket18387() throws IOException, IllegalDataException {
+        try (InputStream is = TestUtils.getRegressionDataStream(18387, "data.osm")) {
+            DataSet ds = OsmReader.parseDataSet(is, null);
+            ArrayList<Way> selection = new ArrayList<>(ds.getWays());
+            assertEquals(2, selection.size());
+            if (!selection.get(0).isNew())
+                Collections.reverse(selection);
+            NodeGraph graph = NodeGraph.createNearlyUndirectedGraphFromNodeWays(selection);
+            List<Node> path = graph.buildSpanningPathNoRemove();
+            assertTrue(path != null);
+        }
+    }
+
+    /**
      * Unit test of methods {@link NodePair#equals} and {@link NodePair#hashCode}.
      */
