1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.validation.tests;
|
---|
3 |
|
---|
4 | import static org.CustomMatchers.isEmpty;
|
---|
5 | import static org.junit.Assert.assertThat;
|
---|
6 |
|
---|
7 | import java.io.FileInputStream;
|
---|
8 | import java.io.FileNotFoundException;
|
---|
9 | import java.io.IOException;
|
---|
10 | import java.io.InputStream;
|
---|
11 |
|
---|
12 | import org.junit.Before;
|
---|
13 | import org.junit.Test;
|
---|
14 | import org.openstreetmap.josm.JOSMFixture;
|
---|
15 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
16 | import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
|
---|
17 | import org.openstreetmap.josm.io.IllegalDataException;
|
---|
18 | import org.openstreetmap.josm.io.OsmReader;
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Unit tests of {@code UnconnectedWays} class.
|
---|
22 | */
|
---|
23 | public class UnconnectedWaysTest {
|
---|
24 |
|
---|
25 | private UnconnectedWays bib;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Setup test.
|
---|
29 | * @throws Exception if the test cannot be initialized
|
---|
30 | */
|
---|
31 | @Before
|
---|
32 | public void setUp() throws Exception {
|
---|
33 | bib = new UnconnectedWays.UnconnectedHighways();
|
---|
34 | JOSMFixture.createUnitTestFixture().init();
|
---|
35 | bib.initialize();
|
---|
36 | bib.startTest(null);
|
---|
37 | }
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/6313">Bug #6313</a>.
|
---|
41 | * @throws IOException if any I/O error occurs
|
---|
42 | * @throws IllegalDataException if the OSM data cannot be parsed
|
---|
43 | * @throws FileNotFoundException if the data file cannot be found
|
---|
44 | */
|
---|
45 | @Test
|
---|
46 | public void testTicket6313() throws IOException, IllegalDataException, FileNotFoundException {
|
---|
47 | try (InputStream fis = new FileInputStream("data_nodist/UnconnectedWaysTest.osm")) {
|
---|
48 | final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
|
---|
49 | bib.visit(ds.allPrimitives());
|
---|
50 | bib.endTest();
|
---|
51 | assertThat(bib.getErrors(), isEmpty());
|
---|
52 | }
|
---|
53 | }
|
---|
54 | }
|
---|