source: josm/trunk/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java@ 9476

Last change on this file since 9476 was 9476, checked in by Don-vip, 8 years ago

see #12376 - add non-regression unit test

File size: 1.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm;
3
4import java.io.FileInputStream;
5import java.io.InputStream;
6
7import org.junit.BeforeClass;
8import org.junit.Rule;
9import org.junit.Test;
10import org.junit.rules.Timeout;
11import org.openstreetmap.josm.JOSMFixture;
12import org.openstreetmap.josm.TestUtils;
13import org.openstreetmap.josm.io.Compression;
14import org.openstreetmap.josm.io.OsmReader;
15
16/**
17 * Unit tests of the {@code MultipolygonBuilder} class.
18 */
19public 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}
Note: See TracBrowser for help on using the repository browser.