1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.osm;
|
---|
3 |
|
---|
4 | import java.io.FileInputStream;
|
---|
5 | import java.io.InputStream;
|
---|
6 |
|
---|
7 | import org.junit.BeforeClass;
|
---|
8 | import org.junit.Rule;
|
---|
9 | import org.junit.Test;
|
---|
10 | import org.junit.rules.Timeout;
|
---|
11 | import org.openstreetmap.josm.JOSMFixture;
|
---|
12 | import org.openstreetmap.josm.TestUtils;
|
---|
13 | import org.openstreetmap.josm.io.Compression;
|
---|
14 | import org.openstreetmap.josm.io.OsmReader;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Unit tests of the {@code MultipolygonBuilder} class.
|
---|
18 | */
|
---|
19 | public class MultipolygonBuilderTest {
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * Global timeout applied to all test methods.
|
---|
23 | */
|
---|
24 | @Rule
|
---|
25 | public Timeout globalTimeout = Timeout.seconds(15);
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Setup test.
|
---|
29 | */
|
---|
30 | @BeforeClass
|
---|
31 | public static void init() {
|
---|
32 | JOSMFixture.createUnitTestFixture().init();
|
---|
33 | }
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * Non-regression test for ticket #12060.
|
---|
37 | * @throws Exception if an error occurs
|
---|
38 | */
|
---|
39 | @Test
|
---|
40 | public void testTicket12376() throws Exception {
|
---|
41 | try (InputStream is = new FileInputStream(TestUtils.getRegressionDataFile(12376, "multipolygon_hang.osm.bz2"))) {
|
---|
42 | DataSet ds = OsmReader.parseDataSet(Compression.BZIP2.getUncompressedInputStream(is), null);
|
---|
43 | for (Relation r : ds.getRelations()) {
|
---|
44 | new MultipolygonBuilder().makeFromWays(r.getMemberPrimitives(Way.class));
|
---|
45 | }
|
---|
46 | }
|
---|
47 | }
|
---|
48 | }
|
---|