Index: trunk/test/data/alignCircleBuildingsAfter.osm
===================================================================
--- trunk/test/data/alignCircleBuildingsAfter.osm	(revision 18615)
+++ trunk/test/data/alignCircleBuildingsAfter.osm	(revision 18615)
@@ -0,0 +1,69 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<osm version='0.6' generator='JOSM'>
+  <node id='-201' action='modify' visible='true' lat='8.18118921225' lon='32.15483196352' />
+  <node id='-202' action='modify' visible='true' lat='8.18119339651' lon='32.15483624212' />
+  <node id='-203' action='modify' visible='true' lat='8.1811987769' lon='32.15483881688' />
+  <node id='-204' action='modify' visible='true' lat='8.18120470447' lon='32.15483937724' />
+  <node id='-205' action='modify' visible='true' lat='8.18121046427' lon='32.15483785561' />
+  <node id='-206' action='modify' visible='true' lat='8.18121536158' lon='32.15483443553' />
+  <node id='-207' action='modify' visible='true' lat='8.18121880571' lon='32.15482952951' />
+  <node id='-208' action='modify' visible='true' lat='8.18122038125' lon='32.15482372927' />
+  <node id='-209' action='modify' visible='true' lat='8.18121989817' lon='32.15481773443' />
+  <node id='-210' action='modify' visible='true' lat='8.18121741473' lon='32.15481226805' />
+  <node id='-211' action='modify' visible='true' lat='8.18121323048' lon='32.15480798944' />
+  <node id='-212' action='modify' visible='true' lat='8.18120785009' lon='32.15480541468' />
+  <node id='-213' action='modify' visible='true' lat='8.18120192252' lon='32.15480485432' />
+  <node id='-214' action='modify' visible='true' lat='8.18119616272' lon='32.15480637595' />
+  <node id='-215' action='modify' visible='true' lat='8.18119126541' lon='32.15480979603' />
+  <node id='-216' action='modify' visible='true' lat='8.18118782128' lon='32.15481470206' />
+  <node id='-217' action='modify' visible='true' lat='8.18118624574' lon='32.15482050229' />
+  <node id='-218' action='modify' visible='true' lat='8.18118672882' lon='32.15482649713' />
+  <node id='-101' action='modify' visible='true' lat='8.18124542497' lon='32.15480713489' />
+  <node id='-102' action='modify' visible='true' lat='8.18125347379' lon='32.15481337498' />
+  <node id='-103' action='modify' visible='true' lat='8.18126361593' lon='32.1548136437' />
+  <node id='-104' action='modify' visible='true' lat='8.18127197743' lon='32.1548078384' />
+  <node id='-105' action='modify' visible='true' lat='8.18127536449' lon='32.15479817652' />
+  <node id='-106' action='modify' visible='true' lat='8.18127248336' lon='32.15478834856' />
+  <node id='-107' action='modify' visible='true' lat='8.18126443454' lon='32.15478210847' />
+  <node id='-108' action='modify' visible='true' lat='8.18125429241' lon='32.15478183976' />
+  <node id='-109' action='modify' visible='true' lat='8.1812459309' lon='32.15478764505' />
+  <node id='-110' action='modify' visible='true' lat='8.18124254385' lon='32.15479730693' />
+  <way id='-200' action='modify' visible='true'>
+    <nd ref='-201' />
+    <nd ref='-202' />
+    <nd ref='-203' />
+    <nd ref='-204' />
+    <nd ref='-205' />
+    <nd ref='-206' />
+    <nd ref='-207' />
+    <nd ref='-208' />
+    <nd ref='-209' />
+    <nd ref='-210' />
+    <nd ref='-211' />
+    <nd ref='-212' />
+    <nd ref='-213' />
+    <nd ref='-214' />
+    <nd ref='-215' />
+    <nd ref='-216' />
+    <nd ref='-217' />
+    <nd ref='-218' />
+    <nd ref='-201' />
+    <tag k='building' v='yes' />
+    <tag k='test' v='second' />
+  </way>
+  <way id='-100' action='modify' visible='true'>
+    <nd ref='-101' />
+    <nd ref='-102' />
+    <nd ref='-103' />
+    <nd ref='-104' />
+    <nd ref='-105' />
+    <nd ref='-106' />
+    <nd ref='-107' />
+    <nd ref='-108' />
+    <nd ref='-109' />
+    <nd ref='-110' />
+    <nd ref='-101' />
+    <tag k='building' v='yes' />
+    <tag k='test' v='first' />
+  </way>
+</osm>
Index: trunk/test/data/alignCircleBuildingsBefore.osm
===================================================================
--- trunk/test/data/alignCircleBuildingsBefore.osm	(revision 18615)
+++ trunk/test/data/alignCircleBuildingsBefore.osm	(revision 18615)
@@ -0,0 +1,69 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<osm version='0.6' generator='JOSM'>
+  <node id='-201' action='modify' visible='true' lat='8.18118921225' lon='32.15483196352' />
+  <node id='-202' action='modify' visible='true' lat='8.18118681129' lon='32.1548268042' />
+  <node id='-203' action='modify' visible='true' lat='8.18118619859' lon='32.15482113682' />
+  <node id='-204' action='modify' visible='true' lat='8.18118744056' lon='32.15481557553' />
+  <node id='-205' action='modify' visible='true' lat='8.18119040259' lon='32.15481072297' />
+  <node id='-206' action='modify' visible='true' lat='8.18119476373' lon='32.154807105' />
+  <node id='-207' action='modify' visible='true' lat='8.18120005137' lon='32.15480511368' />
+  <node id='-208' action='modify' visible='true' lat='8.1812056925' lon='32.15480496481' />
+  <node id='-209' action='modify' visible='true' lat='8.18121107584' lon='32.1548066745' />
+  <node id='-210' action='modify' visible='true' lat='8.18121561801' lon='32.1548100575' />
+  <node id='-211' action='modify' visible='true' lat='8.1812188268' lon='32.1548147472' />
+  <node id='-212' action='modify' visible='true' lat='8.18122035447' lon='32.15482023541' />
+  <node id='-213' action='modify' visible='true' lat='8.18122003548' lon='32.15482592737' />
+  <node id='-214' action='modify' visible='true' lat='8.18121790441' lon='32.1548312063' />
+  <node id='-215' action='modify' visible='true' lat='8.18120930109' lon='32.15483834355' />
+  <node id='-216' action='modify' visible='true' lat='8.18120376113' lon='32.15483942844' />
+  <node id='-217' action='modify' visible='true' lat='8.18119817269' lon='32.15483863724' />
+  <node id='-218' action='modify' visible='true' lat='8.18119314131' lon='32.15483605568' />
+  <node id='-101' action='modify' visible='true' lat='8.18124560591' lon='32.15480700927' />
+  <node id='-102' action='modify' visible='true' lat='8.18125370049' lon='32.15481306718' />
+  <node id='-103' action='modify' visible='true' lat='8.18126443735' lon='32.15481416717' />
+  <node id='-104' action='modify' visible='true' lat='8.18127197775' lon='32.15480725579' />
+  <node id='-105' action='modify' visible='true' lat='8.18127517917' lon='32.15479760626' />
+  <node id='-106' action='modify' visible='true' lat='8.18127215504' lon='32.15478789853' />
+  <node id='-107' action='modify' visible='true' lat='8.18126406047' lon='32.15478184063' />
+  <node id='-108' action='modify' visible='true' lat='8.18125398734' lon='32.15478174647' />
+  <node id='-109' action='modify' visible='true' lat='8.1812457832' lon='32.15478765201' />
+  <node id='-110' action='modify' visible='true' lat='8.18124258179' lon='32.15479730155' />
+  <way id='-200' action='modify' visible='true'>
+    <nd ref='-201' />
+    <nd ref='-202' />
+    <nd ref='-203' />
+    <nd ref='-204' />
+    <nd ref='-205' />
+    <nd ref='-206' />
+    <nd ref='-207' />
+    <nd ref='-208' />
+    <nd ref='-209' />
+    <nd ref='-210' />
+    <nd ref='-211' />
+    <nd ref='-212' />
+    <nd ref='-213' />
+    <nd ref='-214' />
+    <nd ref='-215' />
+    <nd ref='-216' />
+    <nd ref='-217' />
+    <nd ref='-218' />
+    <nd ref='-201' />
+    <tag k='building' v='yes' />
+    <tag k='test' v='second' />
+  </way>
+  <way id='-100' action='modify' visible='true'>
+    <nd ref='-101' />
+    <nd ref='-102' />
+    <nd ref='-103' />
+    <nd ref='-104' />
+    <nd ref='-105' />
+    <nd ref='-106' />
+    <nd ref='-107' />
+    <nd ref='-108' />
+    <nd ref='-109' />
+    <nd ref='-110' />
+    <nd ref='-101' />
+    <tag k='building' v='yes' />
+    <tag k='test' v='first' />
+  </way>
+</osm>
Index: trunk/test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java	(revision 18614)
+++ trunk/test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java	(revision 18615)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.actions;
 
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -7,5 +8,8 @@
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-
+import static org.junit.jupiter.api.Assertions.fail;
+
+import java.io.IOException;
+import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Paths;
@@ -18,8 +22,11 @@
 import org.openstreetmap.josm.actions.AlignInCircleAction.InvalidSelection;
 import org.openstreetmap.josm.command.Command;
+import org.openstreetmap.josm.data.coor.ILatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
+import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.io.OsmReader;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
@@ -182,3 +189,74 @@
         }
     }
+
+    /**
+     * Test case: Circularize a batch of (two) buildings.
+     * @throws IOException if the test file could not be read
+     * @throws IllegalDataException if the test file has been corrupted
+     */
+    @Test
+    void testMultipleWaysSelected() throws IOException, IllegalDataException {
+        final DataSet before;
+        try (InputStream fis = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "alignCircleBuildingsBefore.osm"))) {
+            before = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
+        }
+
+        Way firstBefore = null;
+        Way secondBefore = null;
+
+        for (Way w : before.getWays()) {
+            if ("first".equals(w.get("test"))) {
+                firstBefore = w;
+            } else if ("second".equals(w.get("test"))) {
+                secondBefore = w;
+            } else {
+                fail("There should only be \"first\" or \"second\" values in the key \"test\"");
+            }
+        }
+
+        assertNotNull(firstBefore);
+        assertNotNull(secondBefore);
+
+        before.clearSelection();
+        before.addSelected(firstBefore);
+        before.addSelected(secondBefore);
+
+        Command c = assertDoesNotThrow(() -> AlignInCircleAction.buildCommand(before));
+        c.executeCommand();
+
+        final DataSet after;
+        try (InputStream fis = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "alignCircleBuildingsAfter.osm"))) {
+            after = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
+        }
+        Way firstAfter = null;
+        Way secondAfter = null;
+
+        for (Way w : after.getWays()) {
+            if ("first".equals(w.get("test"))) {
+                firstAfter = w;
+            } else if ("second".equals(w.get("test"))) {
+                secondAfter = w;
+            } else {
+                fail("There should only be \"first\" or \"second\" values in the key \"test\"");
+            }
+        }
+
+        assertNotNull(firstAfter);
+        assertEquals(firstAfter.getNodesCount(), firstBefore.getNodesCount());
+        for (int i = 0; i < firstAfter.getNodesCount(); i++) {
+            Node bn = firstBefore.getNode(i);
+            Node an = firstAfter.getNode(i);
+            assertEquals(bn.lat(), an.lat(), ILatLon.MAX_SERVER_PRECISION);
+            assertEquals(bn.lon(), an.lon(), ILatLon.MAX_SERVER_PRECISION);
+        }
+
+        assertNotNull(secondAfter);
+        assertEquals(secondAfter.getNodesCount(), secondBefore.getNodesCount());
+        for (int i = 0; i < secondAfter.getNodesCount(); i++) {
+            Node bn = secondBefore.getNode(i);
+            Node an = secondAfter.getNode(i);
+            assertEquals(bn.lat(), an.lat(), ILatLon.MAX_SERVER_PRECISION);
+            assertEquals(bn.lon(), an.lon(), ILatLon.MAX_SERVER_PRECISION);
+        }
+    }
 }
