Index: trunk/.classpath
===================================================================
--- trunk/.classpath	(revision 10936)
+++ trunk/.classpath	(revision 10937)
@@ -17,4 +17,6 @@
 	<classpathentry kind="lib" path="test/lib/equalsverifier-2.1.5.jar"/>
 	<classpathentry kind="lib" path="test/lib/reflections/reflections-0.9.10.jar"/>
+	<classpathentry kind="lib" path="test/lib/reflections/guava-19.0.jar"/>
+	<classpathentry kind="lib" path="test/lib/reflections/javassist-3.20.0-GA.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_102"/>
 	<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
Index: trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
===================================================================
--- trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java	(revision 10936)
+++ trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java	(revision 10937)
@@ -6,5 +6,4 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.io.File;
@@ -40,4 +39,7 @@
 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
 
+/**
+ * Unit tests of {@link MultiFetchServerObjectReader}.
+ */
 public class MultiFetchServerObjectReaderTest {
     private static Logger logger = Logger.getLogger(MultiFetchServerObjectReader.class.getName());
@@ -138,6 +140,10 @@
     }
 
+    /**
+     * Setup test.
+     * @throws Exception if an error occurs
+     */
     @BeforeClass
-    public static void init() throws OsmTransferException {
+    public static void init() throws Exception {
         logger.info("initializing ...");
         JOSMFixture.createFunctionalTestFixture().init();
@@ -177,6 +183,4 @@
                 w.footer();
             }
-        } catch (IOException e) {
-            fail(MessageFormat.format("failed to open file ''{0}'' for writing", dataSetCacheOutputFile.toString()));
         }
     }
@@ -200,4 +204,8 @@
     }
 
+    /**
+     * Test to multi-get 10 nodes.
+     * @throws OsmTransferException if an error occurs
+     */
     @Test
     public void testMultiGet10Nodes() throws OsmTransferException {
@@ -217,4 +225,8 @@
     }
 
+    /**
+     * Test to multi-get 10 ways.
+     * @throws OsmTransferException if an error occurs
+     */
     @Test
     public void testMultiGet10Ways() throws OsmTransferException {
@@ -235,4 +247,8 @@
     }
 
+    /**
+     * Test to multi-get 10 relations.
+     * @throws OsmTransferException if an error occurs
+     */
     @Test
     public void testMultiGet10Relations() throws OsmTransferException {
@@ -253,4 +269,8 @@
     }
 
+    /**
+     * Test to multi-get 800 nodes.
+     * @throws OsmTransferException if an error occurs
+     */
     @Test
     public void testMultiGet800Nodes() throws OsmTransferException {
@@ -270,4 +290,8 @@
     }
 
+    /**
+     * Test to multi-get non-existing node.
+     * @throws OsmTransferException if an error occurs
+     */
     @Test
     public void testMultiGetWithNonExistingNode() throws OsmTransferException {
Index: trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
===================================================================
--- trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java	(revision 10936)
+++ trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java	(revision 10937)
@@ -151,7 +151,8 @@
      * @throws OsmTransferException if something goes wrong
      * @throws CyclicUploadDependencyException if a cyclic dependency is detected
+     * @throws IOException if an I/O error occurs
      */
     @BeforeClass
-    public static void setUpBeforeClass() throws OsmTransferException, CyclicUploadDependencyException {
+    public static void setUpBeforeClass() throws OsmTransferException, CyclicUploadDependencyException, IOException {
         logger.info("initializing ...");
 
@@ -196,6 +197,4 @@
                 w.footer();
             }
-        } catch (IOException e) {
-            fail(MessageFormat.format("failed to open file ''{0}'' for writing", dataSetCacheOutputFile.toString()));
         }
     }
@@ -219,4 +218,8 @@
     }
 
+    /**
+     * Test reading references for a node.
+     * @throws OsmTransferException if an error occurs
+     */
     @Test
     public void testBackreferenceForNode() throws OsmTransferException {
@@ -272,4 +275,8 @@
     }
 
+    /**
+     * Test reading full references for a node.
+     * @throws OsmTransferException if an error occurs
+     */
     @Test
     public void testBackreferenceForNodeFull() throws OsmTransferException {
@@ -316,4 +323,8 @@
     }
 
+    /**
+     * Test reading references for a way.
+     * @throws OsmTransferException if an error occurs
+     */
     @Test
     public void testBackreferenceForWay() throws OsmTransferException {
@@ -356,4 +367,8 @@
     }
 
+    /**
+     * Test reading full references for a way.
+     * @throws OsmTransferException if an error occurs
+     */
     @Test
     public void testBackreferenceForWayFull() throws OsmTransferException {
@@ -390,4 +405,8 @@
     }
 
+    /**
+     * Test reading references for a relation.
+     * @throws OsmTransferException if an error occurs
+     */
     @Test
     public void testBackreferenceForRelation() throws OsmTransferException {
@@ -505,4 +524,8 @@
     }
 
+    /**
+     * Test reading full references for a relation.
+     * @throws OsmTransferException if an error occurs
+     */
     @Test
     public void testBackreferenceForRelationFull() throws OsmTransferException {
Index: trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java	(revision 10936)
+++ trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java	(revision 10937)
@@ -4,5 +4,4 @@
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.awt.geom.Area;
@@ -54,16 +53,11 @@
      * @param p primitive
      * @param ds data set
+     * @throws ReflectiveOperationException if an error occurs
      */
-    public void addSelected(OsmPrimitive p, DataSet ds) {
-        try {
-            Method method = ds.getClass()
-                .getDeclaredMethod("addSelected",
-                                   new Class<?>[] {Collection.class, boolean.class});
-            Utils.setObjectsAccessible(method);
-            method.invoke(ds, Collections.singleton(p), false);
-        } catch (ReflectiveOperationException e) {
-            e.printStackTrace();
-            fail("Can't add OsmPrimitive to dataset: " + e.getMessage());
-        }
+    public void addSelected(OsmPrimitive p, DataSet ds) throws ReflectiveOperationException {
+        Method method = ds.getClass().getDeclaredMethod("addSelected",
+                                                        new Class<?>[] {Collection.class, boolean.class});
+        Utils.setObjectsAccessible(method);
+        method.invoke(ds, Collections.singleton(p), false);
     }
 
@@ -72,7 +66,8 @@
      * circle direction must equals way direction.
      * see #7421
+     * @throws ReflectiveOperationException if an error occurs
      */
     @Test
-    public void testTicket7421case0() {
+    public void testTicket7421case0() throws ReflectiveOperationException {
         DataSet dataSet = new DataSet();
         OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
@@ -137,7 +132,8 @@
      * circle direction depend on traffic hand. Simulate a left hand traffic.
      * see #7421
+     * @throws ReflectiveOperationException if an error occurs
      */
     @Test
-    public void testTicket7421case1() {
+    public void testTicket7421case1() throws ReflectiveOperationException {
         DataSet dataSet = new DataSet();
         OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
@@ -155,15 +151,10 @@
 
         // Mock left/right hand traffic database
-        try {
-            Field leftHandTrafficPolygons = RightAndLefthandTraffic.class
-                .getDeclaredField("leftHandTrafficPolygons");
-            Field rlCache = RightAndLefthandTraffic.class.getDeclaredField("rlCache");
-            Utils.setObjectsAccessible(leftHandTrafficPolygons, rlCache);
-            leftHandTrafficPolygons.set(null, new ArrayList<Area>());
-            rlCache.set(null, new GeoPropertyIndex<>(new ConstantTrafficHand(true), 24));
-        } catch (ReflectiveOperationException e) {
-            e.printStackTrace();
-            fail("Impossible to mock left/right hand database: " + e.getMessage());
-        }
+        Field leftHandTrafficPolygons = RightAndLefthandTraffic.class
+            .getDeclaredField("leftHandTrafficPolygons");
+        Field rlCache = RightAndLefthandTraffic.class.getDeclaredField("rlCache");
+        Utils.setObjectsAccessible(leftHandTrafficPolygons, rlCache);
+        leftHandTrafficPolygons.set(null, new ArrayList<Area>());
+        rlCache.set(null, new GeoPropertyIndex<>(new ConstantTrafficHand(true), 24));
 
         CreateCircleAction action = new CreateCircleAction();
Index: trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java	(revision 10936)
+++ trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java	(revision 10937)
@@ -5,5 +5,4 @@
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.awt.event.InputEvent;
@@ -35,14 +34,9 @@
 
     class SelectActionMock extends SelectAction {
-        SelectActionMock(MapFrame mapFrame, DataSet dataSet, OsmDataLayer layer) {
+        SelectActionMock(MapFrame mapFrame, DataSet dataSet, OsmDataLayer layer) throws ReflectiveOperationException {
             super(mapFrame);
-            try {
-                Field mv = SelectAction.class.getDeclaredField("mv");
-                Utils.setObjectsAccessible(mv);
-                mv.set(this, new MapViewMock());
-            } catch (ReflectiveOperationException e) {
-                e.printStackTrace();
-                fail("Can't setup testing environnement");
-            }
+            Field mv = SelectAction.class.getDeclaredField("mv");
+            Utils.setObjectsAccessible(mv);
+            mv.set(this, new MapViewMock());
         }
 
@@ -68,8 +62,9 @@
      * Resulting way should be attach to the third node.
      * see #10748
+     * @throws ReflectiveOperationException if an error occurs
      */
     @Test
     @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
-    public void testTicket10748() {
+    public void testTicket10748() throws ReflectiveOperationException {
         DataSet dataSet = new DataSet();
         OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
Index: trunk/test/unit/org/openstreetmap/josm/data/osm/APIDataSetTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/osm/APIDataSetTest.java	(revision 10936)
+++ trunk/test/unit/org/openstreetmap/josm/data/osm/APIDataSetTest.java	(revision 10937)
@@ -28,5 +28,5 @@
 
     @Test
-    public void testOneNewRelationOnly() {
+    public void testOneNewRelationOnly() throws CyclicUploadDependencyException {
         Relation r = new Relation();
         r.put("name", "r1");
@@ -36,9 +36,5 @@
         APIDataSet apiDataSet = new APIDataSet();
         apiDataSet.init(ds);
-        try {
-            apiDataSet.adjustRelationUploadOrder();
-        } catch (CyclicUploadDependencyException e) {
-            fail("unexpected exception:" + e);
-        }
+        apiDataSet.adjustRelationUploadOrder();
         List<OsmPrimitive> toAdd = apiDataSet.getPrimitivesToAdd();
 
@@ -48,23 +44,19 @@
 
     @Test
-    public void testNewParentChildPair() {
-        DataSet ds = new DataSet();
-        Relation r1 = new Relation();
-        ds.addPrimitive(r1);
-        r1.put("name", "r1");
-
-        Relation r2 = new Relation();
-        ds.addPrimitive(r2);
-        r2.put("name", "r2");
-
-        r1.addMember(new RelationMember("", r2));
-
-        APIDataSet apiDataSet = new APIDataSet();
-        apiDataSet.init(ds);
-        try {
-            apiDataSet.adjustRelationUploadOrder();
-        } catch (CyclicUploadDependencyException e) {
-            fail("unexpected exception:" + e);
-        }
+    public void testNewParentChildPair() throws CyclicUploadDependencyException {
+        DataSet ds = new DataSet();
+        Relation r1 = new Relation();
+        ds.addPrimitive(r1);
+        r1.put("name", "r1");
+
+        Relation r2 = new Relation();
+        ds.addPrimitive(r2);
+        r2.put("name", "r2");
+
+        r1.addMember(new RelationMember("", r2));
+
+        APIDataSet apiDataSet = new APIDataSet();
+        apiDataSet.init(ds);
+        apiDataSet.adjustRelationUploadOrder();
         List<OsmPrimitive> toAdd = apiDataSet.getPrimitivesToAdd();
 
@@ -75,5 +67,5 @@
 
     @Test
-    public void testOneExistingAndThreNewInAChain() {
+    public void testOneExistingAndThreNewInAChain() throws CyclicUploadDependencyException {
         DataSet ds = new DataSet();
 
@@ -100,9 +92,5 @@
         APIDataSet apiDataSet = new APIDataSet();
         apiDataSet.init(ds);
-        try {
-            apiDataSet.adjustRelationUploadOrder();
-        } catch (CyclicUploadDependencyException e) {
-            fail("unexpected exception:" + e);
-        }
+        apiDataSet.adjustRelationUploadOrder();
         List<OsmPrimitive> toAdd = apiDataSet.getPrimitivesToAdd();
 
@@ -118,5 +106,5 @@
 
     @Test
-    public void testOneParentTwoNewChildren() {
+    public void testOneParentTwoNewChildren() throws CyclicUploadDependencyException {
         DataSet ds = new DataSet();
         Relation r1 = new Relation();
@@ -138,9 +126,5 @@
         APIDataSet apiDataSet = new APIDataSet();
         apiDataSet.init(ds);
-        try {
-            apiDataSet.adjustRelationUploadOrder();
-        } catch (CyclicUploadDependencyException e) {
-            fail("unexpected exception:" + e);
-        }
+        apiDataSet.adjustRelationUploadOrder();
         List<OsmPrimitive> toAdd = apiDataSet.getPrimitivesToAdd();
 
@@ -151,5 +135,5 @@
 
     @Test // for ticket #9624
-    public void testDeleteOneParentTwoNewChildren() {
+    public void testDeleteOneParentTwoNewChildren() throws CyclicUploadDependencyException {
         DataSet ds = new DataSet();
         Relation r1 = new Relation(1);
@@ -185,9 +169,5 @@
         apiDataSet.getPrimitivesToDelete().add(r3);
         apiDataSet.getPrimitivesToDelete().add(r4);
-        try {
-            apiDataSet.adjustRelationUploadOrder();
-        } catch (CyclicUploadDependencyException e) {
-            fail("unexpected exception:" + e);
-        }
+        apiDataSet.adjustRelationUploadOrder();
         List<OsmPrimitive> toDelete = apiDataSet.getPrimitivesToDelete();
 
@@ -198,5 +178,5 @@
 
     @Test // for ticket #9656
-    public void testDeleteWay() {
+    public void testDeleteWay() throws CyclicUploadDependencyException {
         DataSet ds = new DataSet();
         final Way way = new Way(1, 2);
@@ -225,9 +205,5 @@
         APIDataSet apiDataSet = new APIDataSet();
         apiDataSet.init(ds);
-        try {
-            apiDataSet.adjustRelationUploadOrder();
-        } catch (CyclicUploadDependencyException e) {
-            fail("unexpected exception:" + e);
-        }
+        apiDataSet.adjustRelationUploadOrder();
         List<OsmPrimitive> toDelete = apiDataSet.getPrimitivesToDelete();
 
Index: trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java	(revision 10936)
+++ trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java	(revision 10937)
@@ -2,6 +2,7 @@
 package org.openstreetmap.josm.gui;
 
+import static org.junit.Assert.assertNotNull;
+
 import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Modifier;
 import java.util.Arrays;
@@ -53,7 +54,10 @@
     /**
      * Unit test of all table cell renderers against null values.
+     * @throws NoSuchMethodException no default constructor - to fix this, add a default constructor to the class
+     *                               or add the class to the SKIP_TEST list above
+     * @throws ReflectiveOperationException if an error occurs
      */
     @Test
-    public void testTableCellRenderer() {
+    public void testTableCellRenderer() throws ReflectiveOperationException {
         Reflections reflections = new Reflections("org.openstreetmap.josm");
         Set<Class<? extends TableCellRenderer>> renderers = reflections.getSubTypesOf(TableCellRenderer.class);
@@ -67,11 +71,5 @@
                 continue;
             }
-            TableCellRenderer tcr = createInstance(klass);
-            try {
-                tcr.getTableCellRendererComponent(tbl, null, false, false, 0, 0);
-            } catch (NullPointerException npe) {
-                npe.printStackTrace();
-                Assert.fail("NPE in getTableCellRendererComponent");
-            }
+            assertNotNull(createInstance(klass).getTableCellRendererComponent(tbl, null, false, false, 0, 0));
         }
     }
@@ -82,36 +80,22 @@
      * @param klass the class
      * @return an instance of the class
+     * @throws NoSuchMethodException no default constructor - to fix this, add a default constructor to the class
+     *                               or add the class to the SKIP_TEST list above
+     * @throws ReflectiveOperationException if an error occurs
      */
-    private static <T> T createInstance(Class<? extends T> klass) {
+    private static <T> T createInstance(Class<? extends T> klass) throws ReflectiveOperationException {
         boolean needOuterClass = klass.isMemberClass() && !Modifier.isStatic(klass.getModifiers());
         Constructor<? extends T> c;
-        try {
-            if (needOuterClass) {
-                c = klass.getDeclaredConstructor(klass.getDeclaringClass());
-            } else {
-                c = klass.getDeclaredConstructor();
-            }
-        } catch (NoSuchMethodException ex) {
-            // no default constructor - to fix this, add a default constructor
-            // to the class or add the class to the SKIP_TEST list above
-            Assert.fail("No default constructor - cannot test TableCellRenderer: " + ex);
-            return null;
-        } catch (SecurityException ex) {
-            throw new RuntimeException(ex);
+        if (needOuterClass) {
+            c = klass.getDeclaredConstructor(klass.getDeclaringClass());
+        } else {
+            c = klass.getDeclaredConstructor();
         }
         Utils.setObjectsAccessible(c);
-        T o;
-        try {
-            if (needOuterClass) {
-                Object outerInstance = createInstance(klass.getDeclaringClass());
-                o = c.newInstance(outerInstance);
-            } else {
-                o = c.newInstance();
-            }
-        } catch (InstantiationException | IllegalArgumentException | IllegalAccessException | InvocationTargetException ex) {
-            throw new RuntimeException(ex);
+        if (needOuterClass) {
+            return c.newInstance(createInstance(klass.getDeclaringClass()));
+        } else {
+            return c.newInstance();
         }
-        return o;
     }
-
 }
Index: trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModelTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModelTest.java	(revision 10936)
+++ trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModelTest.java	(revision 10937)
@@ -61,17 +61,13 @@
                 break;
             }
-            try {
-                int[] rows = (int[]) idx[i];
-                if (rows.length != 2) {
-                    fail("illegal selection range. Either null or not length 2: " + Arrays.toString(rows));
-                }
-                if (rows[0] > rows[1]) {
-                    fail("illegal selection range. lower bound > upper bound ");
-                }
-                for (int j = rows[0]; j <= rows[1]; j++) {
-                    assertTrue("expected row " + j + " to be selected", model.isSelectedIndex(j));
-                }
-            } catch (ClassCastException e) {
-                fail("illegal selection range:" + idx[i]);
+            int[] rows = (int[]) idx[i];
+            if (rows.length != 2) {
+                fail("illegal selection range. Either null or not length 2: " + Arrays.toString(rows));
+            }
+            if (rows[0] > rows[1]) {
+                fail("illegal selection range. lower bound > upper bound ");
+            }
+            for (int j = rows[0]; j <= rows[1]; j++) {
+                assertTrue("expected row " + j + " to be selected", model.isSelectedIndex(j));
             }
         }
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java	(revision 10936)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java	(revision 10937)
@@ -3,5 +3,4 @@
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
 
 import java.io.BufferedReader;
@@ -41,7 +40,8 @@
     /**
      * Starts Remote control before testing requests.
+     * @throws GeneralSecurityException if a security error occurs
      */
     @Before
-    public void setUp() {
+    public void setUp() throws GeneralSecurityException {
         JOSMFixture.createUnitTestFixture().init();
         RemoteControl.PROP_REMOTECONTROL_HTTPS_ENABLED.put(true);
@@ -70,6 +70,7 @@
      * <a href="http://stackoverflow.com/a/2893932/2257172">here</a> and
      * <a href="http://stackoverflow.com/a/19542614/2257172">here</a>
+     * @throws GeneralSecurityException if a security error occurs
      */
-    public void disableCertificateValidation() {
+    public void disableCertificateValidation() throws GeneralSecurityException {
         // Create a trust manager that does not validate certificate chains
         TrustManager[] trustAllCerts = new TrustManager[] {
@@ -91,11 +92,7 @@
 
         // Install the all-trusting trust manager
-        try {
-            SSLContext sc = SSLContext.getInstance("TLS");
-            sc.init(null, trustAllCerts, new SecureRandom());
-            HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
-        } catch (GeneralSecurityException e) {
-            fail(e.getMessage());
-        }
+        SSLContext sc = SSLContext.getInstance("TLS");
+        sc.init(null, trustAllCerts, new SecureRandom());
+        HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
 
         // Create all-trusting host name verifier
@@ -121,7 +118,8 @@
     /**
      * Tests that sending an HTTP request without command results in HTTP 400, with all available commands in error message.
+     * @throws Exception if an error occurs
      */
     @Test
-    public void testHttpListOfCommands() {
+    public void testHttpListOfCommands() throws Exception {
         testListOfCommands(httpBase);
     }
@@ -129,33 +127,26 @@
     /**
      * Tests that sending an HTTPS request without command results in HTTP 400, with all available commands in error message.
+     * @throws Exception if an error occurs
      */
     @Test
-    public void testHttpsListOfCommands() {
+    public void testHttpsListOfCommands() throws Exception {
         testListOfCommands(httpsBase);
     }
 
-    private void testListOfCommands(String url) {
-        try {
-            HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
-            connection.connect();
-            assertEquals(connection.getResponseCode(), HttpURLConnection.HTTP_BAD_REQUEST);
-            try (InputStream is = connection.getErrorStream()) {
-                // TODO this code should be refactored somewhere in Utils as it is used in several JOSM classes
-                StringBuilder responseBody = new StringBuilder();
-                try (BufferedReader in = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
-                    String s;
-                    while ((s = in.readLine()) != null) {
-                        responseBody.append(s);
-                        responseBody.append("\n");
-                    }
+    private void testListOfCommands(String url) throws IOException, ReflectiveOperationException {
+        HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
+        connection.connect();
+        assertEquals(connection.getResponseCode(), HttpURLConnection.HTTP_BAD_REQUEST);
+        try (InputStream is = connection.getErrorStream()) {
+            // TODO this code should be refactored somewhere in Utils as it is used in several JOSM classes
+            StringBuilder responseBody = new StringBuilder();
+            try (BufferedReader in = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
+                String s;
+                while ((s = in.readLine()) != null) {
+                    responseBody.append(s);
+                    responseBody.append("\n");
                 }
-                assert responseBody.toString().contains(RequestProcessor.getUsageAsHtml());
-            } catch (ReflectiveOperationException e) {
-                e.printStackTrace();
-                fail(e.getMessage());
             }
-        } catch (IOException e) {
-            e.printStackTrace();
-            fail(e.getMessage());
+            assert responseBody.toString().contains(RequestProcessor.getUsageAsHtml());
         }
     }
Index: trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java	(revision 10936)
+++ trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java	(revision 10937)
@@ -1,6 +1,4 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.io.session;
-
-import static org.junit.Assert.fail;
 
 import java.io.File;
@@ -91,5 +89,5 @@
     }
 
-    private void testWrite(List<Layer> layers, final boolean zip) {
+    private void testWrite(List<Layer> layers, final boolean zip) throws IOException {
         Map<Layer, SessionLayerExporter> exporters = new HashMap<>();
         if (zip) {
@@ -107,7 +105,4 @@
         try {
             sw.write(file);
-        } catch (IOException e) {
-            e.printStackTrace();
-            fail(e.getMessage());
         } finally {
             if (file.exists()) {
@@ -148,7 +143,8 @@
     /**
      * Tests to write an empty .jos file.
-     */
-    @Test
-    public void testWriteEmptyJos() {
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    public void testWriteEmptyJos() throws IOException {
         testWrite(Collections.<Layer>emptyList(), false);
     }
@@ -156,7 +152,8 @@
     /**
      * Tests to write an empty .joz file.
-     */
-    @Test
-    public void testWriteEmptyJoz() {
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    public void testWriteEmptyJoz() throws IOException {
         testWrite(Collections.<Layer>emptyList(), true);
     }
@@ -164,7 +161,8 @@
     /**
      * Tests to write a .jos file containing OSM data.
-     */
-    @Test
-    public void testWriteOsmJos() {
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    public void testWriteOsmJos() throws IOException {
         testWrite(Collections.<Layer>singletonList(createOsmLayer()), false);
     }
@@ -172,7 +170,8 @@
     /**
      * Tests to write a .joz file containing OSM data.
-     */
-    @Test
-    public void testWriteOsmJoz() {
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    public void testWriteOsmJoz() throws IOException {
         testWrite(Collections.<Layer>singletonList(createOsmLayer()), true);
     }
@@ -180,7 +179,8 @@
     /**
      * Tests to write a .jos file containing GPX data.
-     */
-    @Test
-    public void testWriteGpxJos() {
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    public void testWriteGpxJos() throws IOException {
         testWrite(Collections.<Layer>singletonList(createGpxLayer()), false);
     }
@@ -188,7 +188,8 @@
     /**
      * Tests to write a .joz file containing GPX data.
-     */
-    @Test
-    public void testWriteGpxJoz() {
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    public void testWriteGpxJoz() throws IOException {
         testWrite(Collections.<Layer>singletonList(createGpxLayer()), true);
     }
@@ -196,7 +197,8 @@
     /**
      * Tests to write a .joz file containing GPX and marker data.
-     */
-    @Test
-    public void testWriteGpxAndMarkerJoz() {
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    public void testWriteGpxAndMarkerJoz() throws IOException {
         GpxLayer gpx = createGpxLayer();
         testWrite(Arrays.asList(gpx, createMarkerLayer(gpx)), true);
@@ -205,7 +207,8 @@
     /**
      * Tests to write a .joz file containing an imagery layer.
-     */
-    @Test
-    public void testWriteImageryLayer() {
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    public void testWriteImageryLayer() throws IOException {
         final Layer layer = createImageryLayer();
         testWrite(Collections.singletonList(layer), true);
@@ -214,7 +217,8 @@
     /**
      * Tests to write a .joz file containing a note layer.
-     */
-    @Test
-    public void testWriteNoteLayer() {
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    public void testWriteNoteLayer() throws IOException {
         final Layer layer = createNoteLayer();
         testWrite(Collections.singletonList(layer), true);
