- Timestamp:
- 2016-06-16T13:43:21+02:00 (8 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerManagerTest.java
r10378 r10397 2 2 package org.openstreetmap.josm.gui.layer; 3 3 4 import static org.hamcrest.CoreMatchers.any; 4 5 import static org.junit.Assert.assertEquals; 5 6 import static org.junit.Assert.assertFalse; … … 11 12 12 13 import java.awt.Graphics2D; 14 import java.lang.reflect.InvocationTargetException; 13 15 import java.util.ArrayList; 14 16 import java.util.Arrays; … … 18 20 19 21 import org.junit.Before; 22 import org.junit.Rule; 20 23 import org.junit.Test; 21 24 import org.openstreetmap.josm.data.Bounds; … … 27 30 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 28 31 import org.openstreetmap.josm.gui.util.GuiHelper; 32 import org.openstreetmap.josm.testutils.ExpectedRootException; 29 33 import org.openstreetmap.josm.tools.Predicates; 34 import org.openstreetmap.josm.tools.bugreport.ReportedException; 30 35 31 36 /** … … 119 124 layerOrderChanged = e; 120 125 } 121 122 126 } 123 127 124 128 protected LayerManager layerManager; 129 130 /** 131 * Rule used to expect exceptions. 132 */ 133 @Rule 134 public ExpectedRootException thrown = ExpectedRootException.none(); 125 135 126 136 /** … … 182 192 * {@link LayerManager#addLayer(Layer)}: duplicate layers 183 193 */ 184 @Test (expected = IllegalArgumentException.class)194 @Test 185 195 public void testAddLayerFails() { 196 thrown.expect(ReportedException.class); 197 thrown.expectCause(any(InvocationTargetException.class)); 198 thrown.expectRootCause(any(IllegalArgumentException.class)); 199 186 200 AbstractTestLayer layer1 = new AbstractTestLayer(); 187 201 layerManager.addLayer(layer1); … … 192 206 * {@link LayerManager#addLayer(Layer)}: illegal default layer position 193 207 */ 194 @Test (expected = IndexOutOfBoundsException.class)208 @Test 195 209 public void testAddLayerIllegalPosition() { 210 thrown.expect(ReportedException.class); 211 thrown.expectCause(any(InvocationTargetException.class)); 212 thrown.expectRootCause(any(IndexOutOfBoundsException.class)); 213 196 214 AbstractTestLayer layer1 = new AbstractTestLayer() { 197 215 @Override … … 260 278 * {@link LayerManager#moveLayer(Layer, int)} fails for wrong index 261 279 */ 262 @Test (expected = IndexOutOfBoundsException.class)280 @Test 263 281 public void testMoveLayerFailsRange() { 282 thrown.expect(ReportedException.class); 283 thrown.expectCause(any(InvocationTargetException.class)); 284 thrown.expectRootCause(any(IndexOutOfBoundsException.class)); 285 264 286 AbstractTestLayer layer1 = new AbstractTestLayer(); 265 287 AbstractTestLayer layer2 = new AbstractTestLayer(); … … 272 294 * {@link LayerManager#moveLayer(Layer, int)} fails for wrong layer 273 295 */ 274 @Test (expected = IllegalArgumentException.class)296 @Test 275 297 public void testMoveLayerFailsNotInList() { 298 thrown.expect(ReportedException.class); 299 thrown.expectCause(any(InvocationTargetException.class)); 300 thrown.expectRootCause(any(IllegalArgumentException.class)); 301 276 302 AbstractTestLayer layer1 = new AbstractTestLayer(); 277 303 AbstractTestLayer layer2 = new AbstractTestLayer();
Note:
See TracChangeset
for help on using the changeset viewer.