Changeset 11978 in josm
- Timestamp:
- 2017-04-22T21:14:24+02:00 (7 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/MoveAction.java
r10409 r11978 28 28 public class MoveAction extends JosmAction { 29 29 30 public enum Direction { UP, LEFT, RIGHT, DOWN } 30 /** 31 * Move direction. 32 */ 33 public enum Direction { 34 /** Move up */ 35 UP, 36 /** Move left */ 37 LEFT, 38 /** Move right */ 39 RIGHT, 40 /** Move down */ 41 DOWN 42 } 31 43 32 44 private final Direction myDirection; -
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r11921 r11978 495 495 } 496 496 497 privateenum Direction {497 enum Direction { 498 498 RIGHT, UP, LEFT, DOWN; 499 499 public Direction changeBy(int directionChange) { -
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r11713 r11978 60 60 private boolean drawTargetHighlight; 61 61 62 privateenum DeleteMode {62 enum DeleteMode { 63 63 none(/* ICON(cursor/modifier/) */ "delete"), 64 64 segment(/* ICON(cursor/modifier/) */ "delete_segment"), … … 75 75 } 76 76 77 /** 78 * Returns the mode cursor. 79 * @return the mode cursor 80 */ 77 81 public Cursor cursor() { 78 82 return c; -
trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java
r11913 r11978 59 59 private static final String CROSSHAIR = "crosshair"; 60 60 61 privateenum State {61 enum State { 62 62 SELECTING, IMPROVING 63 63 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java
r11713 r11978 120 120 // @formatter:on 121 121 122 privateenum Mode {122 enum Mode { 123 123 DRAGGING, NORMAL 124 124 } … … 615 615 } 616 616 617 privateenum Modifier {617 enum Modifier { 618 618 CTRL('c'), 619 619 ALT('a'), -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r11913 r11978 86 86 87 87 // contains all possible cases the cursor can be in the SelectAction 88 privateenum SelectActionCursor {88 enum SelectActionCursor { 89 89 90 90 rect(NORMAL, "selection"), … … 114 114 } 115 115 116 /** 117 * Returns the action cursor. 118 * @return the cursor 119 */ 116 120 public Cursor cursor() { 117 121 return c; -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r11464 r11978 67 67 private static final String SEARCH_EXPRESSION = "searchExpression"; 68 68 69 /** 70 * Search mode. 71 */ 69 72 public enum SearchMode { 70 73 /** replace selection */ -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r11613 r11978 746 746 public static class ExactKeyValue extends TaggedMatch { 747 747 748 privateenum Mode {748 enum Mode { 749 749 ANY, ANY_KEY, ANY_VALUE, EXACT, NONE, MISSING_KEY, 750 750 ANY_KEY_REGEXP, ANY_VALUE_REGEXP, EXACT_REGEXP, MISSING_KEY_REGEXP; … … 757 757 private final Mode mode; 758 758 759 /** 760 * Constructs a new {@code ExactKeyValue}. 761 * @param regexp regular expression 762 * @param key key 763 * @param value value 764 * @throws ParseError if a parse error occurs 765 */ 759 766 public ExactKeyValue(boolean regexp, String key, String value) throws ParseError { 760 767 if ("".equals(key)) -
trunk/test/unit/org/openstreetmap/josm/TestUtils.java
r11324 r11978 2 2 package org.openstreetmap.josm; 3 3 4 import static org.junit.Assert.assertEquals; 4 5 import static org.junit.Assert.fail; 5 6 … … 10 11 import java.io.InputStream; 11 12 import java.lang.reflect.Field; 13 import java.lang.reflect.Method; 12 14 import java.security.AccessController; 13 15 import java.security.PrivilegedAction; … … 29 31 import org.openstreetmap.josm.io.Compression; 30 32 import org.openstreetmap.josm.testutils.FakeGraphics; 33 import org.openstreetmap.josm.tools.JosmRuntimeException; 34 import org.openstreetmap.josm.tools.Utils; 31 35 32 36 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 286 290 }; 287 291 } 292 293 /** 294 * Ensures 100% code coverage for enums. 295 * @param enumClass enum class to cover 296 */ 297 public static void superficialEnumCodeCoverage(Class<? extends Enum<?>> enumClass) { 298 try { 299 Method values = enumClass.getMethod("values"); 300 Method valueOf = enumClass.getMethod("valueOf", String.class); 301 Utils.setObjectsAccessible(values, valueOf); 302 for (Object o : (Object[]) values.invoke(null)) { 303 assertEquals(o, valueOf.invoke(null, ((Enum<?>) o).name())); 304 } 305 } catch (IllegalArgumentException | ReflectiveOperationException | SecurityException e) { 306 throw new JosmRuntimeException(e); 307 } 308 } 288 309 } -
trunk/test/unit/org/openstreetmap/josm/actions/ExtensionFileFilterTest.java
r10956 r11978 5 5 6 6 import org.junit.Test; 7 import org.openstreetmap.josm.TestUtils; 8 import org.openstreetmap.josm.actions.ExtensionFileFilter.AddArchiveExtension; 7 9 8 10 import nl.jqno.equalsverifier.EqualsVerifier; … … 47 49 .verify(); 48 50 } 51 52 /** 53 * Unit test of {@link AddArchiveExtension} enum. 54 */ 55 @Test 56 public void testEnumAddArchiveExtension() { 57 TestUtils.superficialEnumCodeCoverage(AddArchiveExtension.class); 58 } 49 59 } -
trunk/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java
r11921 r11978 11 11 import org.junit.Test; 12 12 import org.openstreetmap.josm.TestUtils; 13 import org.openstreetmap.josm.actions.OrthogonalizeAction.Direction; 13 14 import org.openstreetmap.josm.actions.search.SearchCompiler; 14 15 import org.openstreetmap.josm.data.coor.LatLon; … … 16 17 import org.openstreetmap.josm.data.osm.Node; 17 18 import org.openstreetmap.josm.data.osm.Way; 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer;19 19 import org.openstreetmap.josm.io.OsmReader; 20 20 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 26 26 27 27 /** 28 * Unit tests for class {@link O smDataLayer}.28 * Unit tests for class {@link OrthogonalizeAction}. 29 29 */ 30 30 public class OrthogonalizeActionTest { … … 111 111 } 112 112 } 113 114 /** 115 * Unit test of {@link Direction} enum. 116 */ 117 @Test 118 public void testEnumDirection() { 119 TestUtils.superficialEnumCodeCoverage(Direction.class); 120 } 113 121 } -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DeleteActionTest.java
r11713 r11978 8 8 import org.junit.Test; 9 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.TestUtils; 11 import org.openstreetmap.josm.actions.mapmode.DeleteAction.DeleteMode; 10 12 import org.openstreetmap.josm.data.osm.DataSet; 11 13 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 43 45 } 44 46 } 47 48 /** 49 * Unit test of {@link DeleteMode} enum. 50 */ 51 @Test 52 public void testEnumDeleteMode() { 53 TestUtils.superficialEnumCodeCoverage(DeleteMode.class); 54 } 45 55 } -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java
r11713 r11978 8 8 import org.junit.Test; 9 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.TestUtils; 11 import org.openstreetmap.josm.actions.mapmode.ExtrudeAction.Mode; 10 12 import org.openstreetmap.josm.data.osm.DataSet; 11 13 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 43 45 } 44 46 } 47 48 /** 49 * Unit test of {@link Mode} enum. 50 */ 51 @Test 52 public void testEnumMode() { 53 TestUtils.superficialEnumCodeCoverage(Mode.class); 54 } 45 55 } -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java
r11713 r11978 8 8 import org.junit.Test; 9 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.TestUtils; 11 import org.openstreetmap.josm.actions.mapmode.ImproveWayAccuracyAction.State; 10 12 import org.openstreetmap.josm.data.osm.DataSet; 11 13 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 43 45 } 44 46 } 47 48 /** 49 * Unit test of {@link State} enum. 50 */ 51 @Test 52 public void testEnumState() { 53 TestUtils.superficialEnumCodeCoverage(State.class); 54 } 45 55 } -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java
r10945 r11978 8 8 import org.junit.Test; 9 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.TestUtils; 11 import org.openstreetmap.josm.actions.mapmode.ParallelWayAction.Mode; 12 import org.openstreetmap.josm.actions.mapmode.ParallelWayAction.Modifier; 10 13 import org.openstreetmap.josm.data.osm.DataSet; 11 14 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 43 46 } 44 47 } 48 49 /** 50 * Unit test of {@link Mode} enum. 51 */ 52 @Test 53 public void testEnumMode() { 54 TestUtils.superficialEnumCodeCoverage(Mode.class); 55 } 56 57 /** 58 * Unit test of {@link Modifier} enum. 59 */ 60 @Test 61 public void testEnumModifier() { 62 TestUtils.superficialEnumCodeCoverage(Modifier.class); 63 } 45 64 } -
trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java
r10945 r11978 15 15 import org.junit.Test; 16 16 import org.openstreetmap.josm.Main; 17 import org.openstreetmap.josm.TestUtils; 18 import org.openstreetmap.josm.actions.mapmode.SelectAction.Mode; 19 import org.openstreetmap.josm.actions.mapmode.SelectAction.SelectActionCursor; 17 20 import org.openstreetmap.josm.data.coor.EastNorth; 18 21 import org.openstreetmap.josm.data.osm.DataSet; … … 142 145 } 143 146 } 147 148 /** 149 * Unit test of {@link Mode} enum. 150 */ 151 @Test 152 public void testEnumMode() { 153 TestUtils.superficialEnumCodeCoverage(Mode.class); 154 } 155 156 /** 157 * Unit test of {@link SelectActionCursor} enum. 158 */ 159 @Test 160 public void testEnumSelectActionCursor() { 161 TestUtils.superficialEnumCodeCoverage(SelectActionCursor.class); 162 } 144 163 } -
trunk/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java
r11447 r11978 16 16 import org.openstreetmap.josm.TestUtils; 17 17 import org.openstreetmap.josm.actions.search.SearchAction.SearchSetting; 18 import org.openstreetmap.josm.actions.search.SearchCompiler.ExactKeyValue; 18 19 import org.openstreetmap.josm.actions.search.SearchCompiler.Match; 19 20 import org.openstreetmap.josm.actions.search.SearchCompiler.ParseError; … … 482 483 Paths.get(TestUtils.getRegressionDataFile(14217, "filter.txt"))), StandardCharsets.UTF_8))); 483 484 } 485 486 /** 487 * Unit test of {@link SearchCompiler.ExactKeyValue.Mode} enum. 488 */ 489 @Test 490 public void testEnumExactKeyValueMode() { 491 TestUtils.superficialEnumCodeCoverage(ExactKeyValue.Mode.class); 492 } 484 493 }
Note:
See TracChangeset
for help on using the changeset viewer.