Skip to content

Commit d0dcfb2

Browse files
author
taylor.smock
committed
See #21605: Add tabs to ImageViewerDialog for use with different image layers
This fixes a broken test. This occurred because this was the only location where GeoImageLayer was initialized with a `null` image list. We also needed to add `main()` from JOSMTestRules due to initializing the image viewer in the constructor, if no image viewer was already initialized. git-svn-id: https://josm.openstreetmap.de/svn/trunk@18614 0c6e7542-c601-0410-84e7-c038aed88b3b
1 parent e9cced1 commit d0dcfb2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33

44
import static org.junit.jupiter.api.Assertions.assertThrows;
55

6+
import java.util.Collections;
7+
8+
import org.junit.jupiter.api.extension.RegisterExtension;
69
import org.openstreetmap.josm.data.osm.DataSet;
710
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
11+
import org.openstreetmap.josm.testutils.JOSMTestRules;
812
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
913

1014
import org.junit.jupiter.api.Test;
@@ -15,12 +19,16 @@
1519
// Basic preferences are needed for OSM primitives
1620
@BasicPreferences
1721
class GeoImageLayerTest {
22+
@RegisterExtension
23+
static JOSMTestRules josmTestRules = new JOSMTestRules().main();
1824

1925
/**
2026
* Test that {@link GeoImageLayer#mergeFrom} throws IAE for invalid arguments
2127
*/
2228
@Test
2329
void testMergeFromIAE() {
24-
assertThrows(IllegalArgumentException.class, () -> new GeoImageLayer(null, null).mergeFrom(new OsmDataLayer(new DataSet(), "", null)));
30+
GeoImageLayer geoImageLayer = new GeoImageLayer(Collections.emptyList(), null);
31+
OsmDataLayer osmDataLayer = new OsmDataLayer(new DataSet(), "", null);
32+
assertThrows(IllegalArgumentException.class, () -> geoImageLayer.mergeFrom(osmDataLayer));
2533
}
2634
}

0 commit comments

Comments
 (0)