Index: trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java	(revision 12561)
+++ trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java	(revision 12562)
@@ -170,41 +170,6 @@
             return;
 
-        DataSet ds = getLayerManager().getEditDataSet();
-        List<Node> selectedNodes = new ArrayList<>(ds.getSelectedNodes());
-        List<Way> selectedWays = new ArrayList<>(ds.getSelectedWays());
-        selectedWays.removeIf(OsmPrimitive::isIncomplete);
-
         try {
-            Command cmd;
-            // Decide what to align based on selection:
-
-            if (selectedNodes.isEmpty() && !selectedWays.isEmpty()) {
-                // Only ways selected -> For each way align their nodes taking care of intersection
-                cmd = alignMultiWay(selectedWays);
-            } else if (selectedNodes.size() == 1) {
-                // Only 1 node selected -> align this node relative to referers way
-                Node selectedNode = selectedNodes.get(0);
-                List<Way> involvedWays;
-                if (selectedWays.isEmpty())
-                    // No selected way, all way containing this node are used
-                    involvedWays = selectedNode.getParentWays();
-                else
-                    // Selected way, use only these ways
-                    involvedWays = selectedWays;
-                List<Line> lines = getInvolvedLines(selectedNode, involvedWays);
-                if (lines.size() > 2 || lines.isEmpty())
-                    throw new InvalidSelection();
-                cmd = alignSingleNode(selectedNodes.get(0), lines);
-            } else if (selectedNodes.size() >= 3) {
-                // More than 3 nodes and way(s) selected -> align selected nodes. Don't care of way(s).
-                cmd = alignOnlyNodes(selectedNodes);
-            } else {
-                // All others cases are invalid
-                throw new InvalidSelection();
-            }
-
-            // Do it!
-            Main.main.undoRedo.add(cmd);
-
+            Main.main.undoRedo.add(buildCommand());
         } catch (InvalidSelection except) {
             Main.debug(except);
@@ -212,4 +177,43 @@
                 .setIcon(JOptionPane.INFORMATION_MESSAGE)
                 .show();
+        }
+    }
+
+    /**
+     * Builds "align in line" command depending on the selected objects.
+     * @return the resulting command to execute to perform action
+     * @throws InvalidSelection if a polygon is selected, or if a node is used by 3 or more ways
+     * @since 12562
+     */
+    public Command buildCommand() throws InvalidSelection {
+        DataSet ds = getLayerManager().getEditDataSet();
+        List<Node> selectedNodes = new ArrayList<>(ds.getSelectedNodes());
+        List<Way> selectedWays = new ArrayList<>(ds.getSelectedWays());
+        selectedWays.removeIf(OsmPrimitive::isIncomplete);
+
+        // Decide what to align based on selection:
+        if (selectedNodes.isEmpty() && !selectedWays.isEmpty()) {
+            // Only ways selected -> For each way align their nodes taking care of intersection
+            return alignMultiWay(selectedWays);
+        } else if (selectedNodes.size() == 1) {
+            // Only 1 node selected -> align this node relative to referers way
+            Node selectedNode = selectedNodes.get(0);
+            List<Way> involvedWays;
+            if (selectedWays.isEmpty())
+                // No selected way, all way containing this node are used
+                involvedWays = selectedNode.getParentWays();
+            else
+                // Selected way, use only these ways
+                involvedWays = selectedWays;
+            List<Line> lines = getInvolvedLines(selectedNode, involvedWays);
+            if (lines.size() > 2 || lines.isEmpty())
+                throw new InvalidSelection();
+            return alignSingleNode(selectedNodes.get(0), lines);
+        } else if (selectedNodes.size() >= 3) {
+            // More than 3 nodes and way(s) selected -> align selected nodes. Don't care of way(s).
+            return alignOnlyNodes(selectedNodes);
+        } else {
+            // All others cases are invalid
+            throw new InvalidSelection();
         }
     }
Index: trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java
===================================================================
--- trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java	(revision 12561)
+++ trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java	(revision 12562)
@@ -154,5 +154,5 @@
     @Test
     public void testRelativeRedirects() throws IOException {
-        final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/relative-redirect/5")).connect(progress);
+        final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/relative-redirect/3")).connect(progress);
         assertThat(response.getResponseCode(), is(200));
         assertThat(response.getContentLength() > 100, is(true));
@@ -161,5 +161,5 @@
     @Test
     public void testAbsoluteRedirects() throws IOException {
-        final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/absolute-redirect/5")).connect(progress);
+        final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/absolute-redirect/3")).connect(progress);
         assertThat(response.getResponseCode(), is(200));
         assertThat(response.getContentLength() > 100, is(true));
@@ -168,5 +168,5 @@
     @Test(expected = IOException.class)
     public void testTooMuchRedirects() throws IOException {
-        HttpClient.create(new URL("https://httpbin.org/redirect/5")).setMaxRedirects(4).connect(progress);
+        HttpClient.create(new URL("https://httpbin.org/redirect/3")).setMaxRedirects(2).connect(progress);
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/MainTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/MainTest.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/MainTest.java	(revision 12562)
@@ -20,5 +20,4 @@
 import javax.swing.UIManager;
 
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -47,14 +46,5 @@
     @Rule
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().platform().https().devAPI();
-
-    /**
-     * Setup test.
-     */
-    @Before
-    public void setUp() {
-        JOSMFixture.initContentPane();
-        JOSMFixture.initMainPanel();
-    }
+    public JOSMTestRules test = new JOSMTestRules().platform().https().devAPI().main();
 
     /**
Index: trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java	(revision 12562)
@@ -30,10 +30,8 @@
     /**
      * We need prefs for this. We need platform for actions and the OSM API for checking blacklist.
-     * The timeout is set to default httpclient read timeout + connect timeout + a small delay to ignore
-     * common but harmless network issues.
      */
     @Rule
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().platform().fakeAPI().timeout(45500);
+    public JOSMTestRules test = new JOSMTestRules().preferences().platform().fakeAPI();
 
     /**
Index: trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java	(revision 12562)
@@ -6,6 +6,6 @@
 
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
-import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.AlignInLineAction.InvalidSelection;
@@ -17,4 +17,7 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
@@ -23,4 +26,11 @@
 public final class AlignInLineActionTest {
 
+    /**
+     * Setup test.
+     */
+    @Rule
+    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
+    public JOSMTestRules test = new JOSMTestRules().mainMenu().projection();
+
     /** Class under test. */
     private static AlignInLineAction action;
@@ -31,6 +41,4 @@
     @Before
     public void setUp() {
-        JOSMFixture.createUnitTestFixture().init(true);
-
         // Enable "Align in line" feature.
         action = Main.main.menu.alignInLine;
@@ -43,7 +51,8 @@
      * https://josm.openstreetmap.de/ticket/9605#comment:3. Note that in this test, after alignment, way is overlapping
      * itself.
-     */
-    @Test
-    public void testNodesOpenWay() {
+     * @throws InvalidSelection never
+     */
+    @Test
+    public void testNodesOpenWay() throws InvalidSelection {
         DataSet dataSet = new DataSet();
         OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
@@ -67,5 +76,5 @@
             dataSet.addSelected(point1, point2, point3);
 
-            action.actionPerformed(null);
+            action.buildCommand().executeCommand();
         } finally {
             // Ensure we clean the place before leaving, even if test fails.
@@ -82,7 +91,8 @@
      * Test case: only nodes selected, part of a closed way: align these nodes on the line passing through the most
      * distant nodes.
-     */
-    @Test
-    public void testNodesClosedWay() {
+     * @throws InvalidSelection never
+     */
+    @Test
+    public void testNodesClosedWay() throws InvalidSelection {
         DataSet dataSet = new DataSet();
         OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
@@ -106,5 +116,5 @@
             dataSet.addSelected(point4, point1, point2);
 
-            action.actionPerformed(null);
+            action.buildCommand().executeCommand();
         } finally {
             // Ensure we clean the place before leaving, even if test fails.
@@ -122,7 +132,8 @@
      * Test case: only nodes selected, part of multiple ways: align these nodes on the line passing through the most
      * distant nodes.
-     */
-    @Test
-    public void testNodesOpenWays() {
+     * @throws InvalidSelection never
+     */
+    @Test
+    public void testNodesOpenWays() throws InvalidSelection {
         DataSet dataSet = new DataSet();
         OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
@@ -149,5 +160,5 @@
 
             // Points must align between points 1 and 4.
-            action.actionPerformed(null);
+            action.buildCommand().executeCommand();
         } finally {
             // Ensure we clean the place before leaving, even if test fails.
Index: trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java	(revision 12562)
@@ -38,5 +38,5 @@
     @Rule
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().platform().projection().commands();
+    public JOSMTestRules test = new JOSMTestRules().platform().projection().main();
 
     /**
Index: trunk/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java	(revision 12562)
@@ -17,5 +17,5 @@
     @Rule
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().platform().commands();
+    public JOSMTestRules test = new JOSMTestRules().platform().main();
 
     /**
Index: trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java	(revision 12562)
@@ -47,5 +47,5 @@
     @Rule
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().commands();
+    public JOSMTestRules test = new JOSMTestRules().platform().mainMenu().projection();
 
     /**
Index: trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java	(revision 12562)
@@ -10,4 +10,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
 import org.openstreetmap.josm.gui.layer.LayerManagerTest.TestLayer;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
@@ -26,5 +27,5 @@
     @Rule
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().platform().commands();
+    public JOSMTestRules test = new JOSMTestRules().platform().mainMenu();
 
     private MergeLayerAction action;
@@ -35,4 +36,10 @@
     @Before
     public void setUp() {
+        try {
+            LayerListDialog.getInstance();
+        } catch (IllegalStateException e) {
+            LayerListDialog.createInstance(Main.getLayerManager());
+            Main.trace(e);
+        }
         if (action == null) {
             action = new MergeLayerAction();
Index: trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java	(revision 12562)
@@ -28,5 +28,5 @@
     @Rule
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().platform().commands();
+    public JOSMTestRules test = new JOSMTestRules().platform().projection();
 
     /**
Index: trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java	(revision 12562)
@@ -32,5 +32,5 @@
     @Rule
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().platform().commands();
+    public JOSMTestRules test = new JOSMTestRules().platform().main();
 
     /**
Index: trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java	(revision 12562)
@@ -10,7 +10,7 @@
 import java.util.stream.Stream;
 
-import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
-import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.command.DeleteCommand;
@@ -21,5 +21,8 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.openstreetmap.josm.tools.Utils;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
@@ -34,9 +37,17 @@
      * Setup test.
      */
-    @BeforeClass
-    public static void setUp() {
-        JOSMFixture.createUnitTestFixture().init(true);
-        action = Main.main.menu.simplifyWay;
-        action.setEnabled(true);
+    @Rule
+    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
+    public JOSMTestRules test = new JOSMTestRules().mainMenu();
+
+    /**
+     * Setup test.
+     */
+    @Before
+    public void setUp() {
+        if (action == null) {
+            action = Main.main.menu.simplifyWay;
+            action.setEnabled(true);
+        }
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java	(revision 12562)
@@ -11,7 +11,7 @@
 import java.util.Iterator;
 
-import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
-import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.SplitWayAction.Strategy;
@@ -25,4 +25,7 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
@@ -37,9 +40,17 @@
      * Setup test.
      */
-    @BeforeClass
-    public static void setUp() {
-        JOSMFixture.createUnitTestFixture().init(true);
-        action = Main.main.menu.splitWay;
-        action.setEnabled(true);
+    @Rule
+    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
+    public JOSMTestRules test = new JOSMTestRules().mainMenu().projection();
+
+    /**
+     * Setup test.
+     */
+    @Before
+    public void setUp() {
+        if (action == null) {
+            action = Main.main.menu.splitWay;
+            action.setEnabled(true);
+        }
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java	(revision 12562)
@@ -5,7 +5,7 @@
 import static org.junit.Assert.assertTrue;
 
-import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
-import org.openstreetmap.josm.JOSMFixture;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -14,4 +14,7 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 /**
@@ -26,9 +29,17 @@
      * Setup test.
      */
-    @BeforeClass
-    public static void setUp() {
-        JOSMFixture.createUnitTestFixture().init(true);
-        action = Main.main.menu.unglueNodes;
-        action.setEnabled(true);
+    @Rule
+    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
+    public JOSMTestRules test = new JOSMTestRules().mainMenu();
+
+    /**
+     * Setup test.
+     */
+    @Before
+    public void setUp() {
+        if (action == null) {
+            action = Main.main.menu.unglueNodes;
+            action.setEnabled(true);
+        }
     }
 
Index: trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java	(revision 12561)
+++ trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java	(revision 12562)
@@ -213,5 +213,5 @@
 
     /**
-     * Use the {@link Main#main} application in this test.
+     * Use the {@link Main#main}, {@code Main.contentPanePrivate}, {@code Main.mainPanel}, {@link Main#toolbar} global variables in this test.
      * @return this instance, for easy chaining
      * @since 12557
@@ -340,9 +340,10 @@
             if (main) {
                 new MainApplication();
+                JOSMFixture.initContentPane();
+                JOSMFixture.initMainPanel();
+                JOSMFixture.initToolbar();
             }
 
             if (mainMenu) {
-                JOSMFixture.initContentPane();
-                JOSMFixture.initToolbar();
                 Main.main.menu = new MainMenu();
             }
