Changeset 10222 in josm
- Timestamp:
- 2016-05-15T21:14:06+02:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/build.xml
r10171 r10222 676 676 excludeFilter="tools/findbugs/josm-filter.xml" 677 677 effort="max" 678 reportLevel="low" 678 679 > 679 680 <sourcePath path="${base.dir}/src" /> -
trunk/scripts/SyncEditorImageryIndex.groovy
r10077 r10222 24 24 import org.openstreetmap.josm.data.imagery.ImageryInfo 25 25 import org.openstreetmap.josm.io.imagery.ImageryReader 26 27 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings 26 28 27 29 class SyncEditorImageryIndex { … … 177 179 } 178 180 181 @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD") 179 182 void myprintln(String s) { 180 183 if(skipEntries.containsKey(s)) { -
trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
r9655 r10222 18 18 import java.text.MessageFormat; 19 19 import java.util.ArrayList; 20 import java.util.Locale; 20 21 import java.util.logging.Logger; 21 22 … … 151 152 152 153 String p = System.getProperties().getProperty("useCachedDataset"); 153 if (p != null && Boolean.parseBoolean(p.trim().toLowerCase( ))) {154 if (p != null && Boolean.parseBoolean(p.trim().toLowerCase(Locale.ENGLISH))) { 154 155 logger.info(MessageFormat.format("property ''{0}'' set, using cached dataset", "useCachedDataset")); 155 156 return; -
trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
r9374 r10222 18 18 import java.text.MessageFormat; 19 19 import java.util.HashSet; 20 import java.util.Locale; 20 21 import java.util.Set; 21 22 import java.util.logging.Logger; … … 169 170 170 171 String p = System.getProperty("useCachedDataset"); 171 if (p != null && Boolean.parseBoolean(p.trim().toLowerCase( ))) {172 if (p != null && Boolean.parseBoolean(p.trim().toLowerCase(Locale.ENGLISH))) { 172 173 logger.info(MessageFormat.format("property ''{0}'' set, using cached dataset", "useCachedDataset")); 173 174 return; … … 516 517 DataSet referers = reader.parseOsm(NullProgressMonitor.INSTANCE); 517 518 518 Set<Long> referringRelationsIds = new HashSet<>();519 519 r = lookupRelation(referers, 6); 520 520 assertNotNull(r); 521 521 assertFalse(r.isIncomplete()); 522 referringRelationsIds.add(r.getId());523 522 r = lookupRelation(referers, 7); 524 523 assertNotNull(r); 525 524 assertFalse(r.isIncomplete()); 526 referringRelationsIds.add(r.getId());527 525 r = lookupRelation(referers, 8); 528 526 assertNotNull(r); 529 527 assertFalse(r.isIncomplete()); 530 referringRelationsIds.add(r.getId());531 528 r = lookupRelation(referers, 9); 532 529 assertNotNull(r); 533 530 assertFalse(r.isIncomplete()); 534 referringRelationsIds.add(r.getId());535 531 536 532 // all relations are fully loaded -
trunk/test/functional/org/openstreetmap/josm/io/UploadStrategySelectionPanelTest.java
r8514 r10222 20 20 public class UploadStrategySelectionPanelTest extends JFrame { 21 21 22 pr ivateUploadStrategySelectionPanel uploadStrategySelectionPanel;22 protected UploadStrategySelectionPanel uploadStrategySelectionPanel; 23 23 24 24 protected void build() { … … 37 37 tf.addActionListener( 38 38 new ActionListener() { 39 public void actionPerformed(ActionEvent arg0) { 39 @Override 40 public void actionPerformed(ActionEvent ae) { 40 41 int n = 0; 41 42 try { -
trunk/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java
r10002 r10222 20 20 import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer; 21 21 import org.openstreetmap.josm.data.osm.OsmDataGenerator.KeyValueDataGenerator; 22 23 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 22 24 23 25 /** … … 38 40 */ 39 41 @Rule 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 40 43 public Timeout globalTimeout = Timeout.seconds(15*60); 41 44 … … 52 55 */ 53 56 @Test 54 public void meassureStringEqualsIntern() { 57 @SuppressFBWarnings(value = "DM_STRING_CTOR", justification = "test Strings that are interned and those that are not") 58 public void measureStringEqualsIntern() { 55 59 String str1Interned = "string1"; 56 60 String str1InternedB = "string1"; … … 196 200 */ 197 201 @Test 202 @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT") 198 203 public void testKeyValueGetKeysGet() { 199 204 for (double tagNodeRatio : TAG_NODE_RATIOS) { -
trunk/test/performance/org/openstreetmap/josm/data/osm/RoundingPerformanceTest.java
r7937 r10222 7 7 import org.openstreetmap.josm.data.coor.LatLon; 8 8 import org.openstreetmap.josm.data.coor.LatLonTest; 9 10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 9 11 10 12 /** … … 22 24 */ 23 25 @Test 26 @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT") 24 27 public void test() { 25 28 final int n = 1000000; -
trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java
r10197 r10222 24 24 import org.openstreetmap.josm.io.OsmReader; 25 25 26 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 27 26 28 /** 27 29 * Abstract superclass of {@code StyledMapRendererPerformanceTest} and {@code WireframeMapRendererPerformanceTest}. … … 32 34 private static final int IMG_HEIGHT = 1050; 33 35 36 @SuppressFBWarnings(value = "MS_PKGPROTECT") 34 37 protected static Graphics2D g; 38 @SuppressFBWarnings(value = "MS_PKGPROTECT") 35 39 protected static BufferedImage img; 40 @SuppressFBWarnings(value = "MS_PKGPROTECT") 36 41 protected static NavigatableComponent nc; 37 42 private static DataSet dsRestriction; … … 43 48 */ 44 49 @Rule 50 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 45 51 public Timeout globalTimeout = Timeout.seconds(15*60); 46 52 … … 121 127 } 122 128 123 /** run this manually to verify that the rendering is set up properly */ 129 /** 130 * run this manually to verify that the rendering is set up properly 131 * @throws IOException if any I/O error occurs 132 */ 133 @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD") 124 134 private void dumpRenderedImage() throws IOException { 125 File outputfile = new File("test-neubrandenburg.png"); 126 ImageIO.write(img, "png", outputfile); 135 ImageIO.write(img, "png", new File("test-neubrandenburg.png")); 127 136 } 128 137 } -
trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererPerformanceTest.java
r10197 r10222 9 9 import org.junit.BeforeClass; 10 10 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 11 12 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 11 13 12 14 /** … … 27 29 } 28 30 29 /** run this manually to verify that the rendering is set up properly */ 31 /** 32 * run this manually to verify that the rendering is set up properly 33 * @throws IOException if any I/O error occurs 34 */ 35 @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD") 30 36 private void dumpRenderedImage() throws IOException { 31 File outputfile = new File("test-neubrandenburg.png"); 32 ImageIO.write(img, "png", outputfile); 37 ImageIO.write(img, "png", new File("test-neubrandenburg.png")); 33 38 } 34 39 } -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java
r9793 r10222 12 12 import java.util.EnumMap; 13 13 import java.util.List; 14 import java.util.Locale; 14 15 import java.util.Map; 15 16 … … 41 42 import org.openstreetmap.josm.io.OsmReader; 42 43 44 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 45 43 46 public class MapRendererPerformanceTest { 44 47 … … 65 68 ICON, SYMBOL, NODE_TEXT, LINE, LINE_TEXT, AREA; 66 69 public String label() { 67 return name().toLowerCase( );70 return name().toLowerCase(Locale.ENGLISH); 68 71 } 69 72 } … … 75 78 */ 76 79 @Rule 80 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 77 81 public Timeout globalTimeout = Timeout.seconds(15*60); 78 82 … … 171 175 private final List<Long> totalTimes = new ArrayList<>(); 172 176 177 @SuppressFBWarnings(value = "DM_GC") 173 178 public void run() throws IOException { 174 179 boolean checkScale = false; … … 314 319 315 320 public static void dumpTimes(StyledMapRenderer.BenchmarkData bd) { 316 System.out.print(String.format("gen. %3d, sort %3d, draw %3d \n", bd.generateTime, bd.sortTime, bd.drawTime));321 System.out.print(String.format("gen. %3d, sort %3d, draw %3d%n", bd.generateTime, bd.sortTime, bd.drawTime)); 317 322 } 318 323 -
trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java
r9771 r10222 13 13 import org.openstreetmap.josm.gui.mappaint.MultiCascade; 14 14 15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 16 15 17 /** 16 18 * Tests how fast {@link MapCSSStyleSource} finds the right style candidates for one object. … … 21 23 private static final int TEST_RULE_COUNT = 10000; 22 24 23 private class CssGenerator {25 private static class CssGenerator { 24 26 StringBuilder sb = new StringBuilder(); 25 27 private KeyValueDataGenerator generator; … … 83 85 */ 84 86 @Rule 87 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 85 88 public Timeout globalTimeout = Timeout.seconds(15*60); 86 89 -
trunk/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java
r9491 r10222 20 20 import org.openstreetmap.josm.data.osm.DataSet; 21 21 22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 23 22 24 /** 23 25 * This test tests how fast we are at reading an OSM file. … … 35 37 */ 36 38 @Rule 39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 40 public Timeout globalTimeout = Timeout.seconds(15*60); 38 41 -
trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
r10019 r10222 8 8 import java.nio.file.Paths; 9 9 import java.text.MessageFormat; 10 import java.util.Locale; 10 11 11 12 import org.openstreetmap.josm.data.projection.Projections; … … 106 107 // make sure we don't upload to or test against production 107 108 // 108 String url = OsmApi.getOsmApi().getBaseUrl().toLowerCase( ).trim();109 String url = OsmApi.getOsmApi().getBaseUrl().toLowerCase(Locale.ENGLISH).trim(); 109 110 if (url.startsWith("http://www.openstreetmap.org") || url.startsWith("http://api.openstreetmap.org") 110 111 || url.startsWith("https://www.openstreetmap.org") || url.startsWith("https://api.openstreetmap.org")) { -
trunk/test/unit/org/openstreetmap/josm/MainTest.java
r10200 r10222 16 16 import org.openstreetmap.josm.gui.MainApplication; 17 17 import org.openstreetmap.josm.tools.WindowGeometry; 18 19 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 18 20 19 21 /** … … 57 59 */ 58 60 @Test 61 @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD") 59 62 public void testLogs() { 60 63 -
trunk/test/unit/org/openstreetmap/josm/TestUtils.java
r9954 r10222 47 47 import org.openstreetmap.josm.io.Compression; 48 48 49 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 50 49 51 /** 50 52 * Various utils, useful for unit tests. … … 105 107 * @param array The array sorted for test purpose 106 108 */ 109 @SuppressFBWarnings(value = "RV_NEGATING_RESULT_OF_COMPARETO") 107 110 public static <T> void checkComparableContract(Comparator<T> comparator, T[] array) { 108 111 System.out.println("Validating Comparable contract on array of "+array.length+" elements"); -
trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java
r9661 r10222 9 9 import java.lang.reflect.Field; 10 10 import java.lang.reflect.Method; 11 import java.security.AccessController; 12 import java.security.PrivilegedAction; 11 13 import java.util.ArrayList; 12 14 import java.util.Arrays; … … 56 58 public void addSelected(OsmPrimitive p, DataSet ds) { 57 59 try { 58 Method method = ds.getClass()60 final Method method = ds.getClass() 59 61 .getDeclaredMethod("addSelected", 60 62 new Class<?>[] {Collection.class, boolean.class}); 61 method.setAccessible(true); 63 AccessController.doPrivileged(new PrivilegedAction<Object>() { 64 @Override 65 public Object run() { 66 method.setAccessible(true); 67 return null; 68 } 69 }); 62 70 method.invoke(ds, Collections.singleton(p), false); 63 } catch ( Exception e) {71 } catch (ReflectiveOperationException e) { 64 72 e.printStackTrace(); 65 73 fail("Can't add OsmPrimitive to dataset: " + e.getMessage()); … … 162 170 rlCache.setAccessible(true); 163 171 ConstantTrafficHand trafficHand = new ConstantTrafficHand(true); 164 rlCache.set(null, new GeoPropertyIndex< Boolean>(trafficHand, 24));165 } catch ( Exception e) {172 rlCache.set(null, new GeoPropertyIndex<>(trafficHand, 24)); 173 } catch (ReflectiveOperationException e) { 166 174 e.printStackTrace(); 167 175 fail("Impossible to mock left/right hand database: " + e.getMessage()); -
trunk/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java
r9661 r10222 24 24 * Prepare the class for the test. The notification system must be disabled. 25 25 */ 26 public class UnJoinNodeWayActionTestClass extends UnJoinNodeWayAction {26 public static class UnJoinNodeWayActionTestClass extends UnJoinNodeWayAction { 27 27 28 28 /** -
trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandlerTest.java
r9905 r10222 47 47 @Override 48 48 public String[] getPatterns() { 49 return n ull;49 return new String[0]; 50 50 } 51 51 -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/MapViewMock.java
r9669 r10222 13 13 14 14 class MapViewMock extends MapView { 15 private final OsmDataLayer layer;16 private final DataSet currentDataSet;15 private final transient OsmDataLayer layer; 16 private final transient DataSet currentDataSet; 17 17 18 18 MapViewMock(DataSet dataSet, OsmDataLayer layer) { -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java
r9661 r10222 10 10 import java.awt.event.MouseEvent; 11 11 import java.lang.reflect.Field; 12 import java.security.AccessController; 13 import java.security.PrivilegedAction; 12 14 import java.util.Arrays; 13 15 import java.util.Collection; … … 25 27 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 26 28 29 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 30 27 31 /** 28 32 * Unit tests for class {@link SelectAction}. … … 33 37 * Override some configuration variables without change in preferences.xml 34 38 */ 35 class PreferencesMock extends Preferences {39 static class PreferencesMock extends Preferences { 36 40 @Override 37 41 public synchronized int getInteger(String key, int def) { … … 50 54 super(mapFrame); 51 55 try { 52 Field mv = SelectAction.class.getDeclaredField("mv"); 53 mv.setAccessible(true); 56 final Field mv = SelectAction.class.getDeclaredField("mv"); 57 AccessController.doPrivileged(new PrivilegedAction<Object>() { 58 @Override 59 public Object run() { 60 mv.setAccessible(true); 61 return null; 62 } 63 }); 54 64 mv.set(this, new MapViewMock(dataSet, layer)); 55 } catch ( Exception e) {65 } catch (ReflectiveOperationException e) { 56 66 e.printStackTrace(); 57 67 fail("Can't setup testing environnement"); … … 82 92 */ 83 93 @Test 94 @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD") 84 95 public void test10748() { 85 96 DataSet dataSet = new DataSet(); … … 137 148 // As result of test, we must find a 2 nodes way, from EN(0, 0) to EN(100, 0) 138 149 assertTrue("Nodes are not merged", nodesMerged); 139 assertSame(String.format("Expect exactly one way, found %d \n", dataSet.getWays().size()),150 assertSame(String.format("Expect exactly one way, found %d%n", dataSet.getWays().size()), 140 151 dataSet.getWays().size(), 1); 141 152 Way rw = dataSet.getWays().iterator().next(); 142 153 assertFalse("Way shouldn't be deleted\n", rw.isDeleted()); 143 assertSame(String.format("Way shouldn't have 2 nodes, %d found \n", w.getNodesCount()),154 assertSame(String.format("Way shouldn't have 2 nodes, %d found%n", w.getNodesCount()), 144 155 rw.getNodesCount(), 2); 145 156 Node r1 = rw.firstNode(); … … 150 161 r2 = tmp; 151 162 } 152 assertSame(String.format("East should be 0, found %f \n", r1.getEastNorth().east()),163 assertSame(String.format("East should be 0, found %f%n", r1.getEastNorth().east()), 153 164 Double.compare(r1.getEastNorth().east(), 0), 0); 154 assertSame(String.format("East should be 100, found %f \n", r2.getEastNorth().east()),165 assertSame(String.format("East should be 100, found %f%n", r2.getEastNorth().east()), 155 166 Double.compare(r2.getEastNorth().east(), 100), 0); 156 167 } finally { -
trunk/test/unit/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJobTest.java
r10219 r10222 13 13 import org.junit.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 16 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 15 17 16 18 /** … … 59 61 this.attributes = attributes; 60 62 this.ready = true; 61 this.notify ();63 this.notifyAll(); 62 64 } 63 65 } … … 71 73 } 72 74 75 /** 76 * Test status codes 77 * @throws InterruptedException in case of thread interruption 78 * @throws IOException in case of I/O error 79 */ 73 80 @Test 74 public void testStatusCodes() throws Exception{81 public void testStatusCodes() throws IOException, InterruptedException { 75 82 doTestStatusCode(200); 76 83 // can't test for 3xx, as httpstat.us redirects finally to 200 page … … 85 92 } 86 93 94 /** 95 * Test unknown host 96 * @throws InterruptedException in case of thread interruption 97 * @throws IOException in case of I/O error 98 */ 87 99 @Test 88 public void testUnknownHost() throws Exception { 100 @SuppressFBWarnings(value = "WA_NOT_IN_LOOP") 101 public void testUnknownHost() throws IOException, InterruptedException { 89 102 TestCachedTileLoaderJob job = new TestCachedTileLoaderJob("http://unkownhost.unkownhost/unkown"); 90 103 Listener listener = new Listener(); … … 98 111 } 99 112 100 private void doTestStatusCode(int responseCode) throws Exception { 113 @SuppressFBWarnings(value = "WA_NOT_IN_LOOP") 114 private void doTestStatusCode(int responseCode) throws IOException, InterruptedException { 101 115 TestCachedTileLoaderJob job = getStatusLoaderJob(responseCode); 102 116 Listener listener = new Listener(); -
trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java
r9879 r10222 7 7 import org.junit.Test; 8 8 import org.openstreetmap.josm.JOSMFixture; 9 10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 9 11 10 12 /** … … 26 28 * Lat/Lon sample values for unit tests 27 29 */ 30 @SuppressFBWarnings(value = "MS_PKGPROTECT") 28 31 public static final double[] SAMPLE_VALUES = new double[]{ 29 32 -180.0, -179.9, -179.6, -179.5, -179.4, -179.1, -179.0, -100.0, -99.9, -10.0, -9.9, -1.0, -0.1, -
trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java
r10201 r10222 12 12 import org.openstreetmap.josm.io.OsmApi; 13 13 14 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 14 15 import nl.jqno.equalsverifier.EqualsVerifier; 15 16 … … 31 32 */ 32 33 @Test 34 @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD") 33 35 public void testCreateDefault() { 34 36 OAuthParameters def = OAuthParameters.createDefault(); -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetCacheTest.groovy
r8510 r10222 9 9 10 10 @Test 11 public void test _Constructor() {11 public void testConstructor() { 12 12 ChangesetCache cache = ChangesetCache.getInstance() 13 13 assert cache != null … … 15 15 16 16 @Test 17 public void test _addAndRemoveListeners() {17 public void testAddAndRemoveListeners() { 18 18 ChangesetCache cache = ChangesetCache.getInstance() 19 19 cache.clear() … … 38 38 39 39 @Test 40 public void update _get_remove_cycle() {40 public void updateGetRemoveCycle() { 41 41 ChangesetCache cache = ChangesetCache.getInstance() 42 42 cache.clear() … … 97 97 98 98 @Test 99 public void fireingEvents _AddAChangeset() {99 public void fireingEventsAddAChangeset() { 100 100 ChangesetCache cache = ChangesetCache.getInstance() 101 101 cache.clear() … … 118 118 119 119 @Test 120 public void fireingEvents _UpdateChangeset() {120 public void fireingEventsUpdateChangeset() { 121 121 ChangesetCache cache = ChangesetCache.getInstance() 122 122 cache.clear() … … 141 141 142 142 @Test 143 public void fireingEvents _RemoveChangeset() {143 public void fireingEventsRemoveChangeset() { 144 144 ChangesetCache cache = ChangesetCache.getInstance() 145 145 cache.clear() -
trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java
r9214 r10222 161 161 break; 162 162 } 163 default: throw new AssertionError(); 163 164 } 164 165 -
trunk/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java
r9666 r10222 14 14 import org.openstreetmap.josm.io.OsmReader; 15 15 16 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 17 16 18 /** 17 19 * Unit tests of the {@code MultipolygonBuilder} class. … … 23 25 */ 24 26 @Rule 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 28 public Timeout globalTimeout = Timeout.seconds(15); 26 29 -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java
r9459 r10222 10 10 import org.openstreetmap.josm.JOSMFixture; 11 11 import org.openstreetmap.josm.data.coor.LatLon; 12 13 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 12 14 13 15 /** … … 72 74 */ 73 75 @Test 76 @SuppressFBWarnings(value = "DM_STRING_CTOR", justification = "test that equals is used and not ==") 74 77 public void remove() { 75 78 Node n = new Node(); -
trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java
r9716 r10222 34 34 35 35 @Test 36 public void testB Box() {36 public void testBbox() { 37 37 DataSet ds = new DataSet(); 38 38 -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
r10219 r10222 222 222 Process process = pb.start(); 223 223 OutputStream stdin = process.getOutputStream(); 224 final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stdin, StandardCharsets.UTF_8));225 224 InputStream stdout = process.getInputStream(); 226 final BufferedReader reader = new BufferedReader(new InputStreamReader(stdout, StandardCharsets.UTF_8));227 String input = String.format("%.9f %.9f\n", ll.lon(), ll.lat());228 writer.write(input);229 writer.close();230 output = reader.readLine();231 reader.close();225 try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stdin, StandardCharsets.UTF_8))) { 226 writer.write(String.format("%.9f %.9f%n", ll.lon(), ll.lat())); 227 } 228 try (BufferedReader reader = new BufferedReader(new InputStreamReader(stdout, StandardCharsets.UTF_8))) { 229 output = reader.readLine(); 230 } 232 231 } catch (IOException e) { 233 232 System.err.println("Error: Running external command failed: " + e + "\nCommand was: "+Utils.join(" ", args)); -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTestIT.java
r10219 r10222 48 48 import org.junit.Test; 49 49 50 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 51 50 52 /** 51 53 * Integration tests for the DomainValidator. … … 82 84 download(htmlFile, "http://www.iana.org/domains/root/db", timestamp); 83 85 84 BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(txtFile), StandardCharsets.UTF_8)); 85 String line; 86 final String header; 87 line = br.readLine(); // header 88 if (line != null && line.startsWith("# Version ")) { 89 header = line.substring(2); 90 } else { 91 br.close(); 92 throw new IOException("File does not have expected Version header"); 93 } 94 final boolean generateUnicodeTlds = false; // Change this to generate Unicode TLDs as well 95 96 // Parse html page to get entries 97 Map<String, String[]> htmlInfo = getHtmlInfo(htmlFile); 98 Map<String, String> missingTLD = new TreeMap<>(); // stores entry and comments as String[] 99 Map<String, String> missingCC = new TreeMap<>(); 100 while ((line = br.readLine()) != null) { 101 if (!line.startsWith("#")) { 102 final String unicodeTld; // only different from asciiTld if that was punycode 103 final String asciiTld = line.toLowerCase(Locale.ENGLISH); 104 if (line.startsWith("XN--")) { 105 unicodeTld = IDN.toUnicode(line); 106 } else { 107 unicodeTld = asciiTld; 108 } 109 if (!dv.isValidTld(asciiTld)) { 110 String[] info = htmlInfo.get(asciiTld); 111 if (info != null) { 112 String type = info[0]; 113 String comment = info[1]; 114 if ("country-code".equals(type)) { // Which list to use? 115 missingCC.put(asciiTld, unicodeTld + " " + comment); 116 if (generateUnicodeTlds) { 117 missingCC.put(unicodeTld, asciiTld + " " + comment); 86 try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(txtFile), StandardCharsets.UTF_8))) { 87 String line; 88 final String header; 89 line = br.readLine(); // header 90 if (line != null && line.startsWith("# Version ")) { 91 header = line.substring(2); 92 } else { 93 throw new IOException("File does not have expected Version header"); 94 } 95 final boolean generateUnicodeTlds = false; // Change this to generate Unicode TLDs as well 96 97 // Parse html page to get entries 98 Map<String, String[]> htmlInfo = getHtmlInfo(htmlFile); 99 Map<String, String> missingTLD = new TreeMap<>(); // stores entry and comments as String[] 100 Map<String, String> missingCC = new TreeMap<>(); 101 while ((line = br.readLine()) != null) { 102 if (!line.startsWith("#")) { 103 final String unicodeTld; // only different from asciiTld if that was punycode 104 final String asciiTld = line.toLowerCase(Locale.ENGLISH); 105 if (line.startsWith("XN--")) { 106 unicodeTld = IDN.toUnicode(line); 107 } else { 108 unicodeTld = asciiTld; 109 } 110 if (!dv.isValidTld(asciiTld)) { 111 String[] info = htmlInfo.get(asciiTld); 112 if (info != null) { 113 String type = info[0]; 114 String comment = info[1]; 115 if ("country-code".equals(type)) { // Which list to use? 116 missingCC.put(asciiTld, unicodeTld + " " + comment); 117 if (generateUnicodeTlds) { 118 missingCC.put(unicodeTld, asciiTld + " " + comment); 119 } 120 } else { 121 missingTLD.put(asciiTld, unicodeTld + " " + comment); 122 if (generateUnicodeTlds) { 123 missingTLD.put(unicodeTld, asciiTld + " " + comment); 124 } 118 125 } 119 126 } else { 120 missingTLD.put(asciiTld, unicodeTld + " " + comment); 121 if (generateUnicodeTlds) { 122 missingTLD.put(unicodeTld, asciiTld + " " + comment); 123 } 124 } 127 System.err.println("Expected to find HTML info for "+ asciiTld); 128 } 129 } 130 ianaTlds.add(asciiTld); 131 // Don't merge these conditions; generateUnicodeTlds is final so needs to be separate to avoid a warning 132 if (generateUnicodeTlds) { 133 if (!unicodeTld.equals(asciiTld)) { 134 ianaTlds.add(unicodeTld); 135 } 136 } 137 } 138 } 139 // List html entries not in TLD text list 140 for (String key : (new TreeMap<>(htmlInfo)).keySet()) { 141 if (!ianaTlds.contains(key)) { 142 if (isNotInRootZone(key)) { 143 System.out.println("INFO: HTML entry not yet in root zone: "+key); 125 144 } else { 126 System.err.println("Expected to find HTML info for "+ asciiTld); 127 } 128 } 129 ianaTlds.add(asciiTld); 130 // Don't merge these conditions; generateUnicodeTlds is final so needs to be separate to avoid a warning 131 if (generateUnicodeTlds) { 132 if (!unicodeTld.equals(asciiTld)) { 133 ianaTlds.add(unicodeTld); 134 } 135 } 136 } 137 } 138 br.close(); 139 // List html entries not in TLD text list 140 for (String key : (new TreeMap<>(htmlInfo)).keySet()) { 141 if (!ianaTlds.contains(key)) { 142 if (isNotInRootZone(key)) { 143 System.out.println("INFO: HTML entry not yet in root zone: "+key); 144 } else { 145 System.err.println("WARN: Expected to find text entry for html: "+key); 146 } 147 } 148 } 149 if (!missingTLD.isEmpty()) { 150 printMap(header, missingTLD, "TLD"); 151 fail("missing TLD"); 152 } 153 if (!missingCC.isEmpty()) { 154 printMap(header, missingCC, "CC"); 155 fail("missing CC"); 145 System.err.println("WARN: Expected to find text entry for html: "+key); 146 } 147 } 148 } 149 if (!missingTLD.isEmpty()) { 150 printMap(header, missingTLD, "TLD"); 151 fail("missing TLD"); 152 } 153 if (!missingCC.isEmpty()) { 154 printMap(header, missingCC, "CC"); 155 fail("missing CC"); 156 } 156 157 } 157 158 // Check if internal tables contain any additional entries … … 175 176 } 176 177 178 @SuppressFBWarnings(value = "PERFORMANCE") 177 179 private static Map<String, String[]> getHtmlInfo(final File f) throws IOException { 178 180 final Map<String, String[]> info = new HashMap<>(); … … 186 188 final Pattern comment = Pattern.compile("\\s+<td>([^<]+)</td>"); 187 189 188 final BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f), StandardCharsets.UTF_8)); 189 String line; 190 while ((line = br.readLine()) != null) { 191 Matcher m = domain.matcher(line); 192 if (m.lookingAt()) { 193 String dom = m.group(1); 194 String typ = "??"; 195 String com = "??"; 196 line = br.readLine(); 197 while (line != null && line.matches("^\\s*$")) { // extra blank lines introduced 190 try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f), StandardCharsets.UTF_8))) { 191 String line; 192 while ((line = br.readLine()) != null) { 193 Matcher m = domain.matcher(line); 194 if (m.lookingAt()) { 195 String dom = m.group(1); 196 String typ = "??"; 197 String com = "??"; 198 198 line = br.readLine(); 199 } 200 Matcher t = type.matcher(line); 201 if (t.lookingAt()) { 202 typ = t.group(1); 203 line = br.readLine(); 204 if (line != null && line.matches("\\s+<!--.*")) { 205 while (line != null && !line.matches(".*-->.*")) { 199 while (line != null && line.matches("^\\s*$")) { // extra blank lines introduced 200 line = br.readLine(); 201 } 202 Matcher t = type.matcher(line); 203 if (t.lookingAt()) { 204 typ = t.group(1); 205 line = br.readLine(); 206 if (line != null && line.matches("\\s+<!--.*")) { 207 while (line != null && !line.matches(".*-->.*")) { 208 line = br.readLine(); 209 } 206 210 line = br.readLine(); 207 211 } 208 line = br.readLine(); 209 } 210 // Should have comment; is it wrapped? 211 while (line != null && !line.matches(".*</td>.*")) { 212 line += " " +br.readLine(); 213 } 214 Matcher n = comment.matcher(line); 215 if (n.lookingAt()) { 216 com = n.group(1); 217 } 218 // Don't save unused entries 219 if (com.contains("Not assigned") || com.contains("Retired") || typ.equals("test")) { 220 // System.out.println("Ignored: " + typ + " " + dom + " " +com); 212 // Should have comment; is it wrapped? 213 while (line != null && !line.matches(".*</td>.*")) { 214 line += " " +br.readLine(); 215 } 216 Matcher n = comment.matcher(line); 217 if (n.lookingAt()) { 218 com = n.group(1); 219 } 220 // Don't save unused entries 221 if (com.contains("Not assigned") || com.contains("Retired") || typ.equals("test")) { 222 // System.out.println("Ignored: " + typ + " " + dom + " " +com); 223 } else { 224 info.put(dom.toLowerCase(Locale.ENGLISH), new String[]{typ, com}); 225 // System.out.println("Storing: " + typ + " " + dom + " " +com); 226 } 221 227 } else { 222 info.put(dom.toLowerCase(Locale.ENGLISH), new String[]{typ, com}); 223 // System.out.println("Storing: " + typ + " " + dom + " " +com); 224 } 225 } else { 226 System.err.println("Unexpected type: " + line); 227 } 228 } 229 } 230 br.close(); 228 System.err.println("Unexpected type: " + line); 229 } 230 } 231 } 232 } 231 233 return info; 232 234 } … … 262 264 System.out.println("Downloading " + tldurl); 263 265 byte[] buff = new byte[1024]; 264 InputStream is = hc.getInputStream(); 265 266 FileOutputStream fos = new FileOutputStream(f); 267 int len; 268 while ((len = is.read(buff)) != -1) { 269 fos.write(buff, 0, len); 270 } 271 fos.close(); 272 is.close(); 266 try (InputStream is = hc.getInputStream(); 267 FileOutputStream fos = new FileOutputStream(f)) { 268 int len; 269 while ((len = is.read(buff)) != -1) { 270 fos.write(buff, 0, len); 271 } 272 } 273 273 System.out.println("Done"); 274 274 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/EmailValidatorTest.java
r10202 r10222 37 37 * rules from the xml file. 38 38 */ 39 protected static String FORM_KEY = "emailForm";39 protected static final String FORM_KEY = "emailForm"; 40 40 41 41 /** 42 42 * The key used to retrieve the validator action. 43 43 */ 44 protected static String ACTION = "email";44 protected static final String ACTION = "email"; 45 45 46 46 private EmailValidator validator; -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/UrlValidatorTest.java
r10133 r10222 31 31 public class UrlValidatorTest { 32 32 33 private final boolean printStatus = false;34 private final boolean printIndex = false; //print index that indicates current scheme,host,port,path, query test were using.33 private static final boolean printStatus = false; 34 private static final boolean printIndex = false; //print index that indicates current scheme,host,port,path, query test were using. 35 35 36 36 /** -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java
r9490 r10222 65 65 MULTIPOLYGON_TEST.startTest(null); 66 66 67 List<Node> nodes = new ArrayList<>();68 nodes.add(new Node(new LatLon(0, 1)));69 nodes.add(new Node(new LatLon(0, 2)));70 71 67 // Erroneous tag 72 68 Way w = createUnclosedWay("amenity=parking"); -
trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java
r10218 r10222 26 26 import org.xml.sax.SAXException; 27 27 28 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 29 28 30 /** 29 31 * Unit tests of {@link DefaultNameFormatter} class. … … 46 48 */ 47 49 @Test 50 @SuppressFBWarnings(value = "ITA_INEFFICIENT_TO_ARRAY") 48 51 public void testTicket9632() throws IllegalDataException, IOException, SAXException { 49 52 String source = "http://josm.openstreetmap.de/josmfile?page=Presets/BicycleJunction&preset"; -
trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackActionTest.java
r9958 r10222 43 43 */ 44 44 @Test 45 public void testT msLayer() throws Exception {45 public void testTMSLayer() throws Exception { 46 46 // Create new TMS layer and clear cache 47 47 TMSLayer layer = new TMSLayer(new ImageryInfo("OSM TMS", "https://a.tile.openstreetmap.org/{zoom}/{x}/{y}.png", "tms", null, null)); -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPaintPreferenceTestIT.java
r9868 r10222 27 27 import org.openstreetmap.josm.gui.preferences.SourceEditor.ExtendedSourceEntry; 28 28 29 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 30 29 31 /** 30 32 * Integration tests of {@link MapPaintPreference} class. … … 36 38 */ 37 39 @Rule 40 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 41 public Timeout globalTimeout = Timeout.seconds(10*60); 39 42 -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTestIT.java
r9918 r10222 22 22 import org.xml.sax.SAXException; 23 23 24 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 25 24 26 /** 25 27 * Integration tests of {@link TaggingPresetPreference} class. … … 31 33 */ 32 34 @Rule 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 33 36 public Timeout globalTimeout = Timeout.seconds(10*60); 34 37 -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java
r8863 r10222 62 62 @Override 63 63 public String apply(TaggingPresetItem x) { 64 return ((Key) x).key;64 return x instanceof Key ? ((Key) x).key : null; 65 65 } 66 66 }); -
trunk/test/unit/org/openstreetmap/josm/io/ChangesetQueryUrlParserTest.groovy
r8510 r10222 12 12 13 13 @Test 14 public void test _constructor() {15 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 16 } 17 18 @Test 19 public void test _parse_basic() {14 public void testConstructor() { 15 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 16 } 17 18 @Test 19 public void testParseBasic() { 20 20 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 21 21 … … 33 33 34 34 @Test 35 public void test _uid() {35 public void testUid() { 36 36 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 37 37 def ChangesetQuery q … … 55 55 56 56 @Test 57 public void test _display_name() {57 public void testDisplayName() { 58 58 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 59 59 def ChangesetQuery q … … 65 65 } 66 66 67 68 @Test 69 public void test_open() { 67 @Test 68 public void testOpen() { 70 69 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 71 70 def ChangesetQuery q … … 88 87 89 88 @Test 90 public void test _closed() {89 public void testClosed() { 91 90 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 92 91 def ChangesetQuery q … … 108 107 } 109 108 110 111 @Test 112 public void test_uid_and_display_name() { 109 @Test 110 public void testUidAndDisplayName() { 113 111 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 114 112 def ChangesetQuery q … … 121 119 122 120 @Test 123 public void test _time() {121 public void testTime() { 124 122 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 125 123 def ChangesetQuery q … … 151 149 152 150 @Test 153 public void test _bbox() {151 public void testBbox() { 154 152 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 155 153 def ChangesetQuery q … … 185 183 186 184 @Test 187 public void test _changeset_ids() {185 public void testChangesetIds() { 188 186 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 189 187 def ChangesetQuery q -
trunk/test/unit/org/openstreetmap/josm/io/DiffResultProcessorTest.groovy
r8510 r10222 22 22 // these calls should not fail 23 23 // 24 def DiffResultProcessor processor =new DiffResultProcessor(null)25 processor =new DiffResultProcessor([])26 processor =new DiffResultProcessor([n])24 new DiffResultProcessor(null) 25 new DiffResultProcessor([]) 26 new DiffResultProcessor([n]) 27 27 } 28 28 -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java
r10208 r10222 70 70 @Override 71 71 public X509Certificate[] getAcceptedIssuers() { 72 return n ull;72 return new X509Certificate[0]; 73 73 } 74 74 -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java
r10123 r10222 20 20 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 21 21 22 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 23 22 24 /** 23 25 * Integration tests of {@link PluginHandler} class. … … 29 31 */ 30 32 @Rule 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 31 34 public Timeout globalTimeout = Timeout.seconds(10*60); 32 35 -
trunk/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java
r9672 r10222 86 86 @Test 87 87 public void testReadDirection() { 88 Double direction = ExifReader.readDirection(directionSampleFile); 89 assertEquals(new Double(46.5), direction); 88 assertEquals(Double.valueOf(46.5), ExifReader.readDirection(directionSampleFile)); 90 89 } 91 90 -
trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java
r10133 r10222 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.tools.UncheckedParseException; 16 17 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 16 18 17 19 /** … … 192 194 */ 193 195 @Test 196 @SuppressFBWarnings(value = "ISC_INSTANTIATE_STATIC_CLASS") 194 197 public void testCoverage() { 195 198 assertNotNull(new DateUtils());
Note:
See TracChangeset
for help on using the changeset viewer.