source: josm/trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UntaggedNodeTest.java@ 10945

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

convert more unit tests to JOSMTestRules

File size: 2.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.validation.tests;
3
4import static org.CustomMatchers.hasSize;
5import static org.CustomMatchers.isEmpty;
6import static org.junit.Assert.assertThat;
7
8import java.io.InputStream;
9
10import org.junit.Rule;
11import org.junit.Test;
12import org.openstreetmap.josm.TestUtils;
13import org.openstreetmap.josm.data.osm.DataSet;
14import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
15import org.openstreetmap.josm.io.OsmReader;
16import org.openstreetmap.josm.testutils.JOSMTestRules;
17
18import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
19
20/**
21 * Unit tests of {@code UntaggedNode} class.
22 */
23public class UntaggedNodeTest {
24
25 private final UntaggedNode test = new UntaggedNode();
26
27 /**
28 * Setup test.
29 */
30 @Rule
31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
32 public JOSMTestRules rules = new JOSMTestRules();
33
34 /**
35 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/12436">Bug #12436</a>.
36 * @throws Exception if an error occurs
37 */
38 @Test
39 public void testTicket12436() throws Exception {
40 test.initialize();
41 test.startTest(null);
42 try (InputStream fis = TestUtils.getRegressionDataStream(12436, "example.osm")) {
43 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
44 test.visit(ds.allPrimitives());
45 test.endTest();
46 assertThat(test.getErrors(), isEmpty());
47 }
48 }
49
50 /**
51 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/12464">Bug #12464</a>.
52 * @throws Exception if an error occurs
53 */
54 @Test
55 public void testTicket12464() throws Exception {
56 test.initialize();
57 test.startTest(null);
58 try (InputStream fis = TestUtils.getRegressionDataStream(12464, "example.osm")) {
59 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
60 test.visit(ds.allPrimitives());
61 test.endTest();
62 assertThat(test.getErrors(), hasSize(1));
63 }
64 }
65}
Note: See TracBrowser for help on using the repository browser.