Changeset 17275 in josm for trunk/test/unit/org/openstreetmap/josm/command
- Timestamp:
- 2020-10-28T20:41:00+01:00 (5 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/command
- Files:
-
- 28 edited
-
AddCommandTest.java (modified) (9 diffs)
-
AddPrimitivesCommandTest.java (modified) (15 diffs)
-
ChangeCommandTest.java (modified) (11 diffs)
-
ChangeMembersCommandTest.java (modified) (7 diffs)
-
ChangeNodesCommandTest.java (modified) (10 diffs)
-
ChangePropertyCommandTest.java (modified) (13 diffs)
-
ChangePropertyKeyCommandTest.java (modified) (10 diffs)
-
ChangeRelationMemberRoleCommandTest.java (modified) (11 diffs)
-
CommandTest.java (modified) (3 diffs)
-
DeleteCommandTest.java (modified) (24 diffs)
-
MoveCommandTest.java (modified) (19 diffs)
-
PurgeCommandTest.java (modified) (10 diffs)
-
RemoveNodesCommandTest.java (modified) (9 diffs)
-
RotateCommandTest.java (modified) (9 diffs)
-
ScaleCommandTest.java (modified) (9 diffs)
-
SelectCommandTest.java (modified) (12 diffs)
-
SequenceCommandTest.java (modified) (18 diffs)
-
SplitWayCommandTest.java (modified) (15 diffs)
-
TransformNodesCommandTest.java (modified) (3 diffs)
-
conflict/ConflictAddCommandTest.java (modified) (6 diffs)
-
conflict/ConflictResolveCommandTest.java (modified) (3 diffs)
-
conflict/CoordinateConflictResolveCommandTest.java (modified) (8 diffs)
-
conflict/DeletedStateConflictResolveCommandTest.java (modified) (3 diffs)
-
conflict/ModifiedConflictResolveCommandTest.java (modified) (3 diffs)
-
conflict/RelationMemberConflictResolverCommandTest.java (modified) (3 diffs)
-
conflict/TagConflictResolveCommandTest.java (modified) (3 diffs)
-
conflict/VersionConflictResolveCommandTest.java (modified) (3 diffs)
-
conflict/WayNodesConflictResolverCommandTest.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/command/AddCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.util.ArrayList; 8 8 9 import org.junit. Rule;10 import org.junit.Test; 9 import org.junit.jupiter.api.extension.RegisterExtension; 10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.TestUtils; 12 12 import org.openstreetmap.josm.data.coor.LatLon; … … 27 27 * Unit tests of {@link AddCommand} class. 28 28 */ 29 publicclass AddCommandTest {29 class AddCommandTest { 30 30 31 31 /** 32 32 * We need prefs for nodes. 33 33 */ 34 @R ule34 @RegisterExtension 35 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 36 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 40 40 */ 41 41 @Test 42 publicvoid testAdd() {42 void testAdd() { 43 43 DataSet ds = new DataSet(); 44 44 assertArrayEquals(new Object[0], ds.allPrimitives().toArray()); … … 56 56 */ 57 57 @Test 58 publicvoid testAddToLayer() {58 void testAddToLayer() { 59 59 DataSet ds1 = new DataSet(); 60 60 DataSet ds2 = new DataSet(); … … 71 71 */ 72 72 @Test 73 publicvoid testUndo() {73 void testUndo() { 74 74 Node osm = new Node(LatLon.ZERO); 75 75 DataSet ds = new DataSet(osm); … … 86 86 */ 87 87 @Test 88 publicvoid testParticipatingPrimitives() {88 void testParticipatingPrimitives() { 89 89 Node osm = new Node(LatLon.ZERO); 90 90 … … 96 96 */ 97 97 @Test 98 publicvoid testFillModifiedData() {98 void testFillModifiedData() { 99 99 Node osm = new Node(LatLon.ZERO); 100 100 … … 112 112 */ 113 113 @Test 114 publicvoid testDescription() {114 void testDescription() { 115 115 Node node = new Node(LatLon.ZERO); 116 116 node.put("name", "xy"); … … 131 131 */ 132 132 @Test 133 publicvoid testEqualsContract() {133 void testEqualsContract() { 134 134 TestUtils.assumeWorkingEqualsVerifier(); 135 135 EqualsVerifier.forClass(AddCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/AddPrimitivesCommandTest.java
r17240 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;6 import static org.junit. Assert.assertSame;7 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertSame; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 9 9 import java.util.ArrayList; … … 12 12 import java.util.List; 13 13 14 import org.junit. Rule;15 import org.junit.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 15 import org.junit.jupiter.api.Test; 16 16 import org.openstreetmap.josm.TestUtils; 17 17 import org.openstreetmap.josm.data.coor.LatLon; … … 34 34 * Unit tests of {@link AddPrimitivesCommand} class. 35 35 */ 36 publicclass AddPrimitivesCommandTest {36 class AddPrimitivesCommandTest { 37 37 38 38 /** 39 39 * We need prefs for nodes. 40 40 */ 41 @R ule41 @RegisterExtension 42 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 43 43 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 47 47 */ 48 48 @Test 49 publicvoid testAdd() {49 void testAdd() { 50 50 DataSet ds = new DataSet(); 51 51 … … 61 61 */ 62 62 @Test 63 publicvoid testAddSetSelection() {63 void testAddSetSelection() { 64 64 DataSet ds = new DataSet(); 65 65 … … 77 77 */ 78 78 @Test 79 publicvoid testAddToLayer() {79 void testAddToLayer() { 80 80 DataSet ds1 = new DataSet(); 81 81 DataSet ds2 = new DataSet(); … … 95 95 */ 96 96 @Test 97 publicvoid testAddIgnoresExisting() {97 void testAddIgnoresExisting() { 98 98 DataSet ds = new DataSet(); 99 99 … … 114 114 */ 115 115 @Test 116 publicvoid testDescription() {116 void testDescription() { 117 117 DataSet ds = new DataSet(); 118 118 … … 138 138 */ 139 139 @Test 140 publicvoid testUndo() {140 void testUndo() { 141 141 DataSet ds = new DataSet(); 142 142 … … 172 172 */ 173 173 @Test 174 publicvoid testUndoIgnoresExisting() {174 void testUndoIgnoresExisting() { 175 175 DataSet ds = new DataSet(); 176 176 … … 208 208 */ 209 209 @Test 210 publicvoid testUndoIgnoresExistingAsDeleted() {210 void testUndoIgnoresExistingAsDeleted() { 211 211 DataSet ds = new DataSet(); 212 212 … … 243 243 */ 244 244 @Test 245 publicvoid testUndoIgnoresExistingSameUniqueIdDifferentType() {245 void testUndoIgnoresExistingSameUniqueIdDifferentType() { 246 246 DataSet ds = new DataSet(); 247 247 … … 288 288 */ 289 289 @Test 290 publicvoid testParticipatingPrimitives() {290 void testParticipatingPrimitives() { 291 291 DataSet ds = new DataSet(); 292 292 … … 308 308 */ 309 309 @Test 310 publicvoid testFillModifiedData() {310 void testFillModifiedData() { 311 311 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 312 312 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 364 364 */ 365 365 @Test 366 publicvoid testEqualsContract() {366 void testEqualsContract() { 367 367 TestUtils.assumeWorkingEqualsVerifier(); 368 368 EqualsVerifier.forClass(AddPrimitivesCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ChangeCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit.Assert.assertArrayEquals; 5 import static org.junit.Assert.assertEquals; 6 import static org.junit.Assert.assertNull; 7 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertNull; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.util.ArrayList; … … 11 12 import java.util.List; 12 13 13 import org.junit. Before;14 import org.junit. Rule;15 import org.junit. Test;14 import org.junit.jupiter.api.BeforeEach; 15 import org.junit.jupiter.api.Test; 16 import org.junit.jupiter.api.extension.RegisterExtension; 16 17 import org.openstreetmap.josm.TestUtils; 17 18 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 34 35 * Unit tests of {@link ChangeCommand} class. 35 36 */ 36 publicclass ChangeCommandTest {37 class ChangeCommandTest { 37 38 38 39 /** 39 40 * We need prefs for nodes. 40 41 */ 41 @R ule42 @RegisterExtension 42 43 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 43 44 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 47 48 * Set up the test data. 48 49 */ 49 @Before 50 @BeforeEach 50 51 public void createTestData() { 51 52 testData = new CommandTestData(); … … 55 56 * Test that empty ways are prevented. 56 57 */ 57 @Test (expected = IllegalArgumentException.class)58 publicvoid testPreventEmptyWays() {58 @Test 59 void testPreventEmptyWays() { 59 60 Way emptyWay = new Way(); 60 new ChangeCommand(testData.existingWay, emptyWay); 61 assertThrows(IllegalArgumentException.class, () -> new ChangeCommand(testData.existingWay, emptyWay)); 61 62 } 62 63 … … 65 66 */ 66 67 @Test 67 publicvoid testChange() {68 void testChange() { 68 69 Node newNode = new Node(5); 69 70 newNode.setCoor(LatLon.NORTH_POLE); … … 88 89 * Test {@link ChangeCommand#executeCommand()} fails if ID is changed 89 90 */ 90 @Test (expected = DataIntegrityProblemException.class)91 publicvoid testChangeIdChange() {91 @Test 92 void testChangeIdChange() { 92 93 Node newNode = new Node(1); 93 94 newNode.setCoor(LatLon.NORTH_POLE); 94 95 95 new ChangeCommand(testData.existingNode, newNode).executeCommand(); 96 assertThrows(DataIntegrityProblemException.class, () -> new ChangeCommand(testData.existingNode, newNode).executeCommand()); 96 97 } 97 98 … … 100 101 */ 101 102 @Test 102 publicvoid testUndo() {103 void testUndo() { 103 104 Node newNode = new Node(5); 104 105 newNode.setCoor(LatLon.NORTH_POLE); … … 121 122 */ 122 123 @Test 123 publicvoid testFillModifiedData() {124 void testFillModifiedData() { 124 125 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 125 126 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 135 136 */ 136 137 @Test 137 publicvoid testDescription() {138 void testDescription() { 138 139 Node node = new Node(LatLon.ZERO); 139 140 node.put("name", "xy"); … … 154 155 */ 155 156 @Test 156 publicvoid testEqualsContract() {157 void testEqualsContract() { 157 158 TestUtils.assumeWorkingEqualsVerifier(); 158 159 EqualsVerifier.forClass(ChangeCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ChangeMembersCommandTest.java
r17199 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.util.Collections; 8 8 import java.util.List; 9 9 10 import org.junit. Before;11 import org.junit. Rule;12 import org.junit. Test;10 import org.junit.jupiter.api.BeforeEach; 11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.extension.RegisterExtension; 13 13 import org.openstreetmap.josm.TestUtils; 14 14 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 28 28 * Unit tests of {@link ChangeMembersCommand} class. 29 29 */ 30 publicclass ChangeMembersCommandTest {30 class ChangeMembersCommandTest { 31 31 32 32 /** 33 33 * We need prefs for nodes. 34 34 */ 35 @R ule35 @RegisterExtension 36 36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 37 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 41 41 * Set up the test data. 42 42 */ 43 @Before 43 @BeforeEach 44 44 public void createTestData() { 45 45 testData = new CommandTestDataWithRelation(); … … 50 50 */ 51 51 @Test 52 publicvoid testChange() {52 void testChange() { 53 53 assertTrue(testData.existingNode.getReferrers().contains(testData.existingRelation)); 54 54 assertEquals(2, testData.existingRelation.getMembersCount()); … … 70 70 */ 71 71 @Test 72 publicvoid testUndo() {72 void testUndo() { 73 73 List<RelationMember> members = testData.existingRelation.getMembers(); 74 74 members.add(new RelationMember("n2", testData.existingNode2)); … … 86 86 */ 87 87 @Test 88 publicvoid testDescription() {88 void testDescription() { 89 89 testData.existingRelation.put("name", "xy"); 90 90 List<RelationMember> members = testData.existingRelation.getMembers(); … … 97 97 */ 98 98 @Test 99 publicvoid testEqualsContract() {99 void testEqualsContract() { 100 100 TestUtils.assumeWorkingEqualsVerifier(); 101 101 EqualsVerifier.forClass(ChangeMembersCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ChangeNodesCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit.Assert.assertArrayEquals; 5 import static org.junit.Assert.assertEquals; 6 import static org.junit.Assert.assertFalse; 7 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.util.ArrayList; … … 12 13 import java.util.List; 13 14 14 import org.junit. Before;15 import org.junit. Rule;16 import org.junit. Test;15 import org.junit.jupiter.api.BeforeEach; 16 import org.junit.jupiter.api.Test; 17 import org.junit.jupiter.api.extension.RegisterExtension; 17 18 import org.openstreetmap.josm.TestUtils; 18 19 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 33 34 * Unit tests of {@link ChangeNodesCommand} class. 34 35 */ 35 publicclass ChangeNodesCommandTest {36 class ChangeNodesCommandTest { 36 37 37 38 /** 38 39 * We need prefs for nodes. 39 40 */ 40 @R ule41 @RegisterExtension 41 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 42 43 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 46 47 * Set up the test data. 47 48 */ 48 @Before 49 @BeforeEach 49 50 public void createTestData() { 50 51 testData = new CommandTestData(); … … 54 55 * Test that empty ways are prevented. 55 56 */ 56 @Test (expected = IllegalArgumentException.class)57 publicvoid testPreventEmptyWays() {58 new ChangeNodesCommand(testData.existingWay, Collections.<Node>emptyList()); 57 @Test 58 void testPreventEmptyWays() { 59 assertThrows(IllegalArgumentException.class, () -> new ChangeNodesCommand(testData.existingWay, Collections.<Node>emptyList())); 59 60 } 60 61 … … 63 64 */ 64 65 @Test 65 publicvoid testChange() {66 void testChange() { 66 67 List<Node> newNodes = testData.existingWay.getNodes(); 67 68 Collections.reverse(newNodes); … … 79 80 */ 80 81 @Test 81 publicvoid testUndo() {82 void testUndo() { 82 83 List<Node> newNodes = testData.existingWay.getNodes(); 83 84 Collections.reverse(newNodes); … … 95 96 */ 96 97 @Test 97 publicvoid testFillModifiedData() {98 void testFillModifiedData() { 98 99 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 99 100 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 110 111 */ 111 112 @Test 112 publicvoid testDescription() {113 void testDescription() { 113 114 Node node = new Node(LatLon.ZERO); 114 115 node.put("name", "xy"); … … 125 126 */ 126 127 @Test 127 publicvoid testEqualsContract() {128 void testEqualsContract() { 128 129 TestUtils.assumeWorkingEqualsVerifier(); 129 130 EqualsVerifier.forClass(ChangeNodesCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ChangePropertyCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;6 import static org.junit. Assert.assertFalse;7 import static org.junit. Assert.assertNull;8 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 10 10 import java.util.ArrayList; … … 14 14 import java.util.List; 15 15 16 import org.junit. Before;17 import org.junit. Rule;18 import org.junit. Test;16 import org.junit.jupiter.api.BeforeEach; 17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.extension.RegisterExtension; 19 19 import org.openstreetmap.josm.TestUtils; 20 20 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 36 36 * Unit tests of {@link ChangePropertyCommand} class. 37 37 */ 38 publicclass ChangePropertyCommandTest {38 class ChangePropertyCommandTest { 39 39 40 40 /** 41 41 * We need prefs for nodes. 42 42 */ 43 @R ule43 @RegisterExtension 44 44 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 45 45 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 49 49 * Set up the test data. 50 50 */ 51 @Before 51 @BeforeEach 52 52 public void createTestData() { 53 53 testData = new CommandTestData(); … … 58 58 */ 59 59 @Test 60 publicvoid testShortConstructor() {60 void testShortConstructor() { 61 61 ChangePropertyCommand command = new ChangePropertyCommand(Arrays.asList(testData.existingNode), "a", "b"); 62 62 assertEquals("b", command.getTags().get("a")); … … 74 74 */ 75 75 @Test 76 publicvoid testUpdateSingleProperty() {76 void testUpdateSingleProperty() { 77 77 Node node1 = testData.createNode(14); 78 78 Node node2 = testData.createNode(15); … … 93 93 */ 94 94 @Test 95 publicvoid testRemoveProperty() {95 void testRemoveProperty() { 96 96 Node node1 = testData.createNode(14); 97 97 Node node2 = testData.createNode(15); … … 112 112 */ 113 113 @Test 114 publicvoid testUpdateMultipleProperties() {114 void testUpdateMultipleProperties() { 115 115 Node node1 = testData.createNode(14); 116 116 Node node2 = testData.createNode(15); … … 139 139 */ 140 140 @Test 141 publicvoid testUpdateIgnoresExistingProperty() {141 void testUpdateIgnoresExistingProperty() { 142 142 Node node1 = testData.createNode(14); 143 143 Node node2 = testData.createNode(15); … … 159 159 */ 160 160 @Test 161 publicvoid testFillModifiedData() {161 void testFillModifiedData() { 162 162 Node node1 = testData.createNode(14); 163 163 Node node2 = testData.createNode(15); … … 188 188 */ 189 189 @Test 190 publicvoid testDescription() {190 void testDescription() { 191 191 Node node1 = testData.createNode(14); 192 192 Node node2 = testData.createNode(15); … … 252 252 */ 253 253 @Test 254 publicvoid testChildren() {254 void testChildren() { 255 255 Node node1 = testData.createNode(15); 256 256 Node node2 = testData.createNode(16); … … 278 278 */ 279 279 @Test 280 publicvoid testEqualsContract() {280 void testEqualsContract() { 281 281 TestUtils.assumeWorkingEqualsVerifier(); 282 282 EqualsVerifier.forClass(ChangePropertyCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ChangePropertyKeyCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertNull;7 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertNull; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 9 9 import java.util.ArrayList; … … 11 11 import java.util.Collection; 12 12 13 import org.junit. Before;14 import org.junit. Rule;15 import org.junit. Test;13 import org.junit.jupiter.api.BeforeEach; 14 import org.junit.jupiter.api.Test; 15 import org.junit.jupiter.api.extension.RegisterExtension; 16 16 import org.openstreetmap.josm.TestUtils; 17 17 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 30 30 * Unit tests of {@link ChangePropertyKeyCommand} class. 31 31 */ 32 publicclass ChangePropertyKeyCommandTest {32 class ChangePropertyKeyCommandTest { 33 33 34 34 /** 35 35 * We need prefs for nodes. 36 36 */ 37 @R ule37 @RegisterExtension 38 38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 39 39 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 43 43 * Set up the test data. 44 44 */ 45 @Before 45 @BeforeEach 46 46 public void createTestData() { 47 47 testData = new CommandTestData(); … … 52 52 */ 53 53 @Test 54 publicvoid testChangeKeySingle() {54 void testChangeKeySingle() { 55 55 assertTrue(new ChangePropertyKeyCommand(testData.existingNode, "existing", "newKey").executeCommand()); 56 56 … … 64 64 */ 65 65 @Test 66 publicvoid testChangeKey() {66 void testChangeKey() { 67 67 assertTrue(new ChangePropertyKeyCommand(Arrays.asList(testData.existingNode, testData.existingWay), "existing", 68 68 "newKey").executeCommand()); … … 80 80 */ 81 81 @Test 82 publicvoid testChangeKeyIgnored() {82 void testChangeKeyIgnored() { 83 83 Node node1 = testData.createNode(15); 84 84 node1.removeAll(); … … 109 109 */ 110 110 @Test 111 publicvoid testDescription() {111 void testDescription() { 112 112 Node node1 = testData.createNode(15); 113 113 node1.put("name", "xy"); … … 123 123 */ 124 124 @Test 125 publicvoid testChildren() {125 void testChildren() { 126 126 Node node1 = testData.createNode(15); 127 127 Node node2 = testData.createNode(16); … … 149 149 */ 150 150 @Test 151 publicvoid testEqualsContract() {151 void testEqualsContract() { 152 152 TestUtils.assumeWorkingEqualsVerifier(); 153 153 EqualsVerifier.forClass(ChangePropertyKeyCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;6 import static org.junit. Assert.assertFalse;7 import static org.junit. Assert.assertNull;8 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 9 10 10 import java.util.ArrayList; 11 11 12 import org.junit. Before;13 import org.junit. Rule;14 import org.junit. Test;12 import org.junit.jupiter.api.BeforeEach; 13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 15 15 import org.openstreetmap.josm.TestUtils; 16 16 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 29 29 * Unit tests of {@link ChangeRelationMemberRoleCommand} class. 30 30 */ 31 publicclass ChangeRelationMemberRoleCommandTest {31 class ChangeRelationMemberRoleCommandTest { 32 32 33 33 /** 34 34 * We need prefs for nodes. 35 35 */ 36 @R ule36 @RegisterExtension 37 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 38 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 42 42 * Set up the test data. 43 43 */ 44 @Before 44 @BeforeEach 45 45 public void createTestData() { 46 46 testData = new CommandTestDataWithRelation(); … … 51 51 */ 52 52 @Test 53 publicvoid testRoleChanged() {53 void testRoleChanged() { 54 54 assertTrue(new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "newRole").executeCommand()); 55 55 assertEquals("newRole", testData.existingRelation.getMember(0).getRole()); … … 67 67 */ 68 68 @Test 69 publicvoid testWrongIndex() {69 void testWrongIndex() { 70 70 // should be ignored 71 71 ChangeRelationMemberRoleCommand command1 = new ChangeRelationMemberRoleCommand(testData.existingRelation, -1, "newRole"); … … 85 85 */ 86 86 @Test 87 publicvoid testSameRole() {87 void testSameRole() { 88 88 // should be ignored 89 89 assertTrue(new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "node").executeCommand()); … … 95 95 */ 96 96 @Test 97 publicvoid testUndo() {97 void testUndo() { 98 98 ChangeRelationMemberRoleCommand command = new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "newRole"); 99 99 command.executeCommand(); … … 114 114 */ 115 115 @Test 116 publicvoid testFillModifiedData() {116 void testFillModifiedData() { 117 117 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 118 118 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 128 128 */ 129 129 @Test 130 publicvoid testDescription() {130 void testDescription() { 131 131 testData.existingRelation.put("name", "xy"); 132 132 assertTrue(new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "newRole").getDescriptionText() … … 138 138 */ 139 139 @Test 140 publicvoid testChildren() {140 void testChildren() { 141 141 assertNull(new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "newRole").getChildren()); 142 142 } … … 146 146 */ 147 147 @Test 148 publicvoid testEqualsContract() {148 void testEqualsContract() { 149 149 TestUtils.assumeWorkingEqualsVerifier(); 150 150 EqualsVerifier.forClass(ChangeRelationMemberRoleCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/CommandTest.java
r13079 r17275 4 4 import java.util.Arrays; 5 5 6 import org.junit. Rule;7 import org.junit. Test;6 import org.junit.jupiter.api.Test; 7 import org.junit.jupiter.api.extension.RegisterExtension; 8 8 import org.openstreetmap.josm.TestUtils; 9 9 import org.openstreetmap.josm.data.coor.LatLon; … … 30 30 * We need prefs for nodes / data sets. 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 38 38 */ 39 39 @Test 40 publicvoid testEqualsContract() {40 void testEqualsContract() { 41 41 TestUtils.assumeWorkingEqualsVerifier(); 42 42 EqualsVerifier.forClass(Command.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/DeleteCommandTest.java
r13616 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit.Assert.assertArrayEquals; 5 import static org.junit.Assert.assertEquals; 6 import static org.junit.Assert.assertFalse; 7 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.util.ArrayList; … … 13 14 import java.util.NoSuchElementException; 14 15 15 import org.junit. Before;16 import org.junit. Rule;17 import org.junit. Test;16 import org.junit.jupiter.api.BeforeEach; 17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.extension.RegisterExtension; 18 19 import org.openstreetmap.josm.TestUtils; 19 20 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 35 36 * Unit tests of {@link DeleteCommand} class. 36 37 */ 37 publicclass DeleteCommandTest {38 class DeleteCommandTest { 38 39 39 40 /** 40 41 * We need prefs for nodes. 41 42 */ 42 @R ule43 @RegisterExtension 43 44 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 44 45 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 48 49 * Set up the test data. 49 50 */ 50 @Before 51 @BeforeEach 51 52 public void createTestData() { 52 53 testData = new CommandTestDataWithRelation(); … … 57 58 */ 58 59 @Test 59 publicvoid testSimpleDelete() {60 void testSimpleDelete() { 60 61 Node node = testData.createNode(15); 61 62 assertTrue(testData.layer.data.allPrimitives().contains(node)); … … 72 73 */ 73 74 @Test 74 publicvoid testDeleteIgnoresReferences() {75 void testDeleteIgnoresReferences() { 75 76 assertTrue(testData.existingNode.getReferrers().contains(testData.existingRelation)); 76 77 new DeleteCommand(testData.existingRelation).executeCommand(); … … 92 93 * A delete should delete all objects with references to the deleted one 93 94 */ 94 @Test (expected = IllegalArgumentException.class)95 publicvoid testDeleteFailsOnDelted() {95 @Test 96 void testDeleteFailsOnDeleted() { 96 97 new DeleteCommand(testData.existingRelation).executeCommand(); 97 98 98 new DeleteCommand(testData.existingRelation).executeCommand(); 99 assertThrows(IllegalArgumentException.class, () -> new DeleteCommand(testData.existingRelation).executeCommand()); 99 100 } 100 101 … … 103 104 */ 104 105 @Test 105 publicvoid testReferredDelete() {106 void testReferredDelete() { 106 107 DeleteCommand.deleteWithReferences(Arrays.asList(testData.existingNode), true).executeCommand(); 107 108 … … 115 116 */ 116 117 @Test 117 publicvoid testDeleteNodesInWay() {118 void testDeleteNodesInWay() { 118 119 testData.existingNode.removeAll(); 119 120 // That untagged node should be deleted. … … 152 153 * Test that {@link DeleteCommand} checks for non-null. 153 154 */ 154 @Test (expected = IllegalArgumentException.class)155 publicvoid testConsistency() {156 new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay, null)); 155 @Test 156 void testConsistency() { 157 assertThrows(IllegalArgumentException.class, () -> new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay, null))); 157 158 } 158 159 … … 160 161 * Test that {@link DeleteCommand} checks for the dataset 161 162 */ 162 @Test (expected = IllegalArgumentException.class)163 publicvoid testConsistencyDataset() {163 @Test 164 void testConsistencyDataset() { 164 165 testData.layer.getDataSet().removePrimitive(testData.existingNode); 165 new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay)); 166 assertThrows(IllegalArgumentException.class, () -> new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay))); 166 167 } 167 168 … … 169 170 * Test that {@link DeleteCommand} checks for non-empty list 170 171 */ 171 @Test (expected = NoSuchElementException.class)172 publicvoid testConsistencyNonEmpty() {173 new DeleteCommand(Arrays.<OsmPrimitive>asList()); 172 @Test 173 void testConsistencyNonEmpty() { 174 assertThrows(NoSuchElementException.class, () -> new DeleteCommand(Arrays.<OsmPrimitive>asList())); 174 175 } 175 176 … … 177 178 * Test that {@link DeleteCommand} checks for non-null list 178 179 */ 179 @Test (expected = NullPointerException.class)180 publicvoid testConsistencyNonNull() {181 new DeleteCommand((Collection<OsmPrimitive>) null); 180 @Test 181 void testConsistencyNonNull() { 182 assertThrows(NullPointerException.class, () -> new DeleteCommand((Collection<OsmPrimitive>) null)); 182 183 } 183 184 … … 186 187 */ 187 188 @Test 188 publicvoid testUndo() {189 void testUndo() { 189 190 DeleteCommand command = new DeleteCommand( 190 191 Arrays.asList(testData.existingNode, testData.existingNode2, testData.existingWay)); … … 211 212 */ 212 213 @Test 213 publicvoid testDeleteWaySegment() {214 void testDeleteWaySegment() { 214 215 Way way1 = testData.createWay(100, testData.createNode(101), testData.createNode(102)); 215 216 WaySegment ws = new WaySegment(way1, 0); … … 225 226 */ 226 227 @Test 227 publicvoid testDeleteWaySegmentEndOfWay() {228 void testDeleteWaySegmentEndOfWay() { 228 229 Way way = testData.createWay(200, testData.createNode(201), testData.createNode(202), testData.createNode(203), 229 230 testData.createNode(204)); … … 243 244 */ 244 245 @Test 245 publicvoid testDeleteWaySegmentStartOfWay() {246 void testDeleteWaySegmentStartOfWay() { 246 247 Way way = testData.createWay(100, testData.createNode(101), testData.createNode(102), testData.createNode(103), 247 248 testData.createNode(104)); … … 261 262 */ 262 263 @Test 263 publicvoid testDeleteWaySegmentSplit() {264 void testDeleteWaySegmentSplit() { 264 265 Node node103 = testData.createNode(103); 265 266 Node node104 = testData.createNode(104); … … 285 286 */ 286 287 @Test 287 publicvoid testDeleteWaySegmentCycle() {288 void testDeleteWaySegmentCycle() { 288 289 Node n = testData.createNode(101); 289 290 Way way = testData.createWay(100, n, testData.createNode(102), testData.createNode(103), … … 304 305 */ 305 306 @Test 306 publicvoid testGetChildren() {307 void testGetChildren() { 307 308 testData.existingNode.put("name", "xy"); 308 309 Collection<PseudoCommand> children = new DeleteCommand(Arrays.<OsmPrimitive>asList(testData.existingNode, testData.existingNode2)) … … 319 320 */ 320 321 @Test 321 publicvoid testFillModifiedData() {322 void testFillModifiedData() { 322 323 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 323 324 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 334 335 */ 335 336 @Test 336 publicvoid testGetParticipatingPrimitives() {337 void testGetParticipatingPrimitives() { 337 338 DeleteCommand command = new DeleteCommand(Arrays.<OsmPrimitive>asList(testData.existingNode)); 338 339 assertArrayEquals(new Object[] {testData.existingNode }, command.getParticipatingPrimitives().toArray()); … … 348 349 */ 349 350 @Test 350 publicvoid testDescription() {351 void testDescription() { 351 352 Node node = testData.createNode(100); 352 353 node.put("name", "xy"); … … 378 379 */ 379 380 @Test 380 publicvoid testEqualsContract() {381 void testEqualsContract() { 381 382 TestUtils.assumeWorkingEqualsVerifier(); 382 383 EqualsVerifier.forClass(DeleteCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java
r16968 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.util.ArrayList; … … 12 12 import java.util.Set; 13 13 14 import org.junit. Before;15 import org.junit. Rule;16 import org.junit. Test;14 import org.junit.jupiter.api.BeforeEach; 15 import org.junit.jupiter.api.Test; 16 import org.junit.jupiter.api.extension.RegisterExtension; 17 17 import org.openstreetmap.josm.TestUtils; 18 18 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 34 34 * Unit tests of {@link MoveCommand} class. 35 35 */ 36 publicclass MoveCommandTest {36 class MoveCommandTest { 37 37 /** 38 38 * We need prefs for nodes. 39 39 */ 40 @R ule40 @RegisterExtension 41 41 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 42 42 public JOSMTestRules test = new JOSMTestRules().preferences().i18n().projection(); … … 46 46 * Set up the test data. 47 47 */ 48 @Before 48 @BeforeEach 49 49 public void createTestData() { 50 50 testData = new CommandTestDataWithRelation(); … … 55 55 */ 56 56 @Test 57 publicvoid testConstructors() {57 void testConstructors() { 58 58 EastNorth offset = new EastNorth(1, 2); 59 59 LatLon destLatLon = ProjectionRegistry.getProjection().eastNorth2latlon(offset); … … 75 75 assertEquals(nodes, new ArrayList<>(Collections.<OsmPrimitive>singleton(testData.existingNode))); 76 76 77 assertEquals( "east",1, moveCommand.getOffset().east(), 0.0001);78 assertEquals( "north",2, moveCommand.getOffset().north(), 0.0001);79 assertEquals( "distance",2.236068, moveCommand.getDistance(n -> true), 0.0001);77 assertEquals(1, moveCommand.getOffset().east(), 0.0001, "east"); 78 assertEquals(2, moveCommand.getOffset().north(), 0.0001, "north"); 79 assertEquals(2.236068, moveCommand.getDistance(n -> true), 0.0001, "distance"); 80 80 } 81 81 … … 84 84 */ 85 85 @Test 86 publicvoid testSingleMove() {86 void testSingleMove() { 87 87 MoveCommand command = new MoveCommand(testData.existingNode, 1, 2); 88 88 testData.existingNode.setEastNorth(new EastNorth(3, 7)); 89 89 command.executeCommand(); 90 assertEquals( "east",4, testData.existingNode.getEastNorth().east(), 0.0001);91 assertEquals( "north",9, testData.existingNode.getEastNorth().north(), 0.0001);92 assertEquals( "distance",2.236068, command.getDistance(n -> true), 0.0001);90 assertEquals(4, testData.existingNode.getEastNorth().east(), 0.0001, "east"); 91 assertEquals(9, testData.existingNode.getEastNorth().north(), 0.0001, "north"); 92 assertEquals(2.236068, command.getDistance(n -> true), 0.0001, "distance"); 93 93 } 94 94 … … 97 97 */ 98 98 @Test 99 publicvoid testMultipleMove() {99 void testMultipleMove() { 100 100 MoveCommand command = new MoveCommand( 101 101 Arrays.asList(testData.existingNode, testData.existingNode2, testData.existingWay), … … 106 106 command.executeCommand(); 107 107 108 assertEquals( "east",4, testData.existingNode.getEastNorth().east(), 0.0001);109 assertEquals( "north",9, testData.existingNode.getEastNorth().north(), 0.0001);110 assertEquals( "east",5, testData.existingNode2.getEastNorth().east(), 0.0001);111 assertEquals( "north",9, testData.existingNode2.getEastNorth().north(), 0.0001);108 assertEquals(4, testData.existingNode.getEastNorth().east(), 0.0001, "east"); 109 assertEquals(9, testData.existingNode.getEastNorth().north(), 0.0001, "north"); 110 assertEquals(5, testData.existingNode2.getEastNorth().east(), 0.0001, "east"); 111 assertEquals(9, testData.existingNode2.getEastNorth().north(), 0.0001, "north"); 112 112 } 113 113 … … 116 116 */ 117 117 @Test 118 publicvoid testMoveAgain() {118 void testMoveAgain() { 119 119 MoveCommand command = new MoveCommand(testData.existingNode, 1, 2); 120 assertEquals( "east",1, command.getOffset().east(), 0.0001);121 assertEquals( "north",2, command.getOffset().north(), 0.0001);120 assertEquals(1, command.getOffset().east(), 0.0001, "east"); 121 assertEquals(2, command.getOffset().north(), 0.0001, "north"); 122 122 123 123 command.moveAgain(1, 2); 124 assertEquals( "east",2, command.getOffset().east(), 0.0001);125 assertEquals( "north",4, command.getOffset().north(), 0.0001);124 assertEquals(2, command.getOffset().east(), 0.0001, "east"); 125 assertEquals(4, command.getOffset().north(), 0.0001, "north"); 126 126 127 127 command.moveAgain(-9, -3); 128 assertEquals( "east",-7, command.getOffset().east(), 0.0001);129 assertEquals( "north",1, command.getOffset().north(), 0.0001);128 assertEquals(-7, command.getOffset().east(), 0.0001, "east"); 129 assertEquals(1, command.getOffset().north(), 0.0001, "north"); 130 130 131 131 command.moveAgainTo(1, 2); 132 assertEquals( "east",1, command.getOffset().east(), 0.0001);133 assertEquals( "north",2, command.getOffset().north(), 0.0001);132 assertEquals(1, command.getOffset().east(), 0.0001, "east"); 133 assertEquals(2, command.getOffset().north(), 0.0001, "north"); 134 134 } 135 135 … … 138 138 */ 139 139 @Test 140 publicvoid testCheckpoint() {140 void testCheckpoint() { 141 141 MoveCommand command = new MoveCommand(testData.existingNode, 2, 4); 142 assertEquals( "east",2, command.getOffset().east(), 0.0001);143 assertEquals( "north",4, command.getOffset().north(), 0.0001);142 assertEquals(2, command.getOffset().east(), 0.0001, "east"); 143 assertEquals(4, command.getOffset().north(), 0.0001, "north"); 144 144 145 145 command.saveCheckpoint(); 146 146 command.moveAgain(3, 7); 147 assertEquals( "east",5, command.getOffset().east(), 0.0001);148 assertEquals( "north",11, command.getOffset().north(), 0.0001);147 assertEquals(5, command.getOffset().east(), 0.0001, "east"); 148 assertEquals(11, command.getOffset().north(), 0.0001, "north"); 149 149 150 150 command.resetToCheckpoint(); 151 assertEquals( "east",2, command.getOffset().east(), 0.0001);152 assertEquals( "north",4, command.getOffset().north(), 0.0001);151 assertEquals(2, command.getOffset().east(), 0.0001, "east"); 152 assertEquals(4, command.getOffset().north(), 0.0001, "north"); 153 153 } 154 154 … … 157 157 */ 158 158 @Test 159 publicvoid testStartPoint() {159 void testStartPoint() { 160 160 EastNorth start = new EastNorth(10, 20); 161 161 MoveCommand command = new MoveCommand(testData.existingNode, start, start.add(1, 2)); 162 assertEquals( "east",1, command.getOffset().east(), 0.0001);163 assertEquals( "north",2, command.getOffset().north(), 0.0001);162 assertEquals(1, command.getOffset().east(), 0.0001, "east"); 163 assertEquals(2, command.getOffset().north(), 0.0001, "north"); 164 164 165 165 command.applyVectorTo(start.add(3, 4)); 166 assertEquals( "east",3, command.getOffset().east(), 0.0001);167 assertEquals( "north",4, command.getOffset().north(), 0.0001);166 assertEquals(3, command.getOffset().east(), 0.0001, "east"); 167 assertEquals(4, command.getOffset().north(), 0.0001, "north"); 168 168 169 169 // set to 100, 200 170 170 command.changeStartPoint(new EastNorth(103, 204)); 171 171 command.applyVectorTo(new EastNorth(101, 202)); 172 assertEquals( "east",1, command.getOffset().east(), 0.0001);173 assertEquals( "north",2, command.getOffset().north(), 0.0001);172 assertEquals(1, command.getOffset().east(), 0.0001, "east"); 173 assertEquals(2, command.getOffset().north(), 0.0001, "north"); 174 174 } 175 175 … … 178 178 */ 179 179 @Test 180 publicvoid testNoStartPoint() {180 void testNoStartPoint() { 181 181 MoveCommand command = new MoveCommand(testData.existingNode, 1, 0); 182 182 // ignored 183 183 command.applyVectorTo(new EastNorth(3, 4)); 184 assertEquals( "east",1, command.getOffset().east(), 0.0001);185 assertEquals( "north",0, command.getOffset().north(), 0.0001);184 assertEquals(1, command.getOffset().east(), 0.0001, "east"); 185 assertEquals(0, command.getOffset().north(), 0.0001, "north"); 186 186 187 187 // set to 100, 200 … … 189 189 // works 190 190 command.applyVectorTo(new EastNorth(101, 202)); 191 assertEquals( "east",1, command.getOffset().east(), 0.0001);192 assertEquals( "north",2, command.getOffset().north(), 0.0001);191 assertEquals(1, command.getOffset().east(), 0.0001, "east"); 192 assertEquals(2, command.getOffset().north(), 0.0001, "north"); 193 193 } 194 194 … … 197 197 */ 198 198 @Test 199 publicvoid testUndo() {199 void testUndo() { 200 200 testData.existingNode.setEastNorth(new EastNorth(3, 7)); 201 201 MoveCommand command = new MoveCommand(testData.existingNode, 1, 2); 202 202 command.executeCommand(); 203 assertEquals( "east",4, testData.existingNode.getEastNorth().east(), 0.0001);204 assertEquals( "north",9, testData.existingNode.getEastNorth().north(), 0.0001);203 assertEquals(4, testData.existingNode.getEastNorth().east(), 0.0001, "east"); 204 assertEquals(9, testData.existingNode.getEastNorth().north(), 0.0001, "north"); 205 205 206 206 command.undoCommand(); 207 assertEquals( "east",3, testData.existingNode.getEastNorth().east(), 0.0001);208 assertEquals( "north",7, testData.existingNode.getEastNorth().north(), 0.0001);209 210 command.executeCommand(); 211 assertEquals( "east",4, testData.existingNode.getEastNorth().east(), 0.0001);212 assertEquals( "north",9, testData.existingNode.getEastNorth().north(), 0.0001);207 assertEquals(3, testData.existingNode.getEastNorth().east(), 0.0001, "east"); 208 assertEquals(7, testData.existingNode.getEastNorth().north(), 0.0001, "north"); 209 210 command.executeCommand(); 211 assertEquals(4, testData.existingNode.getEastNorth().east(), 0.0001, "east"); 212 assertEquals(9, testData.existingNode.getEastNorth().north(), 0.0001, "north"); 213 213 } 214 214 … … 217 217 */ 218 218 @Test 219 publicvoid testFillModifiedData() {219 void testFillModifiedData() { 220 220 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 221 221 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 232 232 */ 233 233 @Test 234 publicvoid testGetParticipatingPrimitives() {234 void testGetParticipatingPrimitives() { 235 235 MoveCommand command = new MoveCommand(Arrays.<OsmPrimitive>asList(testData.existingNode), 1, 2); 236 236 command.executeCommand(); … … 248 248 */ 249 249 @Test 250 publicvoid testDescription() {250 void testDescription() { 251 251 Node node = TestUtils.addFakeDataSet(new Node(LatLon.ZERO)); 252 252 node.put("name", "xy"); … … 261 261 */ 262 262 @Test 263 publicvoid testEqualsContract() {263 void testEqualsContract() { 264 264 TestUtils.assumeWorkingEqualsVerifier(); 265 265 EqualsVerifier.forClass(MoveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/PurgeCommandTest.java
r13616 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertNotNull;7 import static org.junit. Assert.assertNull;8 import static org.junit. Assert.assertSame;9 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertNotNull; 7 import static org.junit.jupiter.api.Assertions.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertSame; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 10 10 11 11 import java.util.ArrayList; … … 13 13 import java.util.List; 14 14 15 import org.junit. Before;16 import org.junit. Rule;17 import org.junit. Test;15 import org.junit.jupiter.api.BeforeEach; 16 import org.junit.jupiter.api.Test; 17 import org.junit.jupiter.api.extension.RegisterExtension; 18 18 import org.openstreetmap.josm.TestUtils; 19 19 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 37 37 * Unit tests of {@link PurgeCommand} class. 38 38 */ 39 publicclass PurgeCommandTest {39 class PurgeCommandTest { 40 40 /** 41 41 * We need prefs for nodes. 42 42 */ 43 @R ule43 @RegisterExtension 44 44 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 45 45 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 49 49 * Set up the test data. 50 50 */ 51 @Before 51 @BeforeEach 52 52 public void createTestData() { 53 53 testData = new CommandTestDataWithRelation(); … … 58 58 */ 59 59 @Test 60 publicvoid testExecute() {60 void testExecute() { 61 61 Relation relationParent = testData.createRelation(100, new RelationMember("child", testData.existingRelation)); 62 62 Relation relationParent2 = testData.createRelation(101, new RelationMember("child", testData.existingRelation)); … … 83 83 */ 84 84 @Test 85 publicvoid testUndo() {85 void testUndo() { 86 86 PurgeCommand command = new PurgeCommand(testData.layer.getDataSet(), 87 87 Arrays.<OsmPrimitive>asList(testData.existingNode, testData.existingWay), … … 104 104 */ 105 105 @Test 106 publicvoid testFillModifiedData() {106 void testFillModifiedData() { 107 107 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 108 108 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 121 121 */ 122 122 @Test 123 publicvoid testGetParticipatingPrimitives() {123 void testGetParticipatingPrimitives() { 124 124 PurgeCommand command = new PurgeCommand(testData.layer.getDataSet(), Arrays.<OsmPrimitive>asList(testData.existingNode), 125 125 Arrays.<OsmPrimitive>asList(testData.existingRelation)); … … 131 131 */ 132 132 @Test 133 publicvoid testDescription() {133 void testDescription() { 134 134 List<OsmPrimitive> shortList = Arrays.<OsmPrimitive>asList(testData.existingWay); 135 135 assertTrue(new PurgeCommand(testData.layer.getDataSet(), shortList, Arrays.<OsmPrimitive>asList()).getDescriptionText() … … 145 145 */ 146 146 @Test 147 publicvoid testEqualsContract() {147 void testEqualsContract() { 148 148 TestUtils.assumeWorkingEqualsVerifier(); 149 149 EqualsVerifier.forClass(PurgeCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/RemoveNodesCommandTest.java
r15013 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.util.ArrayList; 9 9 import java.util.Collections; 10 10 11 import org.junit. Before;12 import org.junit. Rule;13 import org.junit. Test;11 import org.junit.jupiter.api.BeforeEach; 12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.extension.RegisterExtension; 14 14 import org.openstreetmap.josm.TestUtils; 15 15 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 28 28 * Unit tests of {@link RemoveNodesCommand} class. 29 29 */ 30 publicclass RemoveNodesCommandTest {30 class RemoveNodesCommandTest { 31 31 32 32 /** 33 33 * We need prefs for nodes. 34 34 */ 35 @R ule35 @RegisterExtension 36 36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 37 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 41 41 * Set up the test data. 42 42 */ 43 @Before 43 @BeforeEach 44 44 public void createTestData() { 45 45 testData = new CommandTestDataWithRelation(); … … 50 50 */ 51 51 @Test 52 publicvoid testExecute() {52 void testExecute() { 53 53 RemoveNodesCommand command = new RemoveNodesCommand(testData.existingWay, 54 54 Collections.singleton(testData.existingNode)); … … 65 65 */ 66 66 @Test 67 publicvoid testUndo() {67 void testUndo() { 68 68 RemoveNodesCommand command = new RemoveNodesCommand(testData.existingWay, 69 69 Collections.singleton(testData.existingNode)); … … 87 87 */ 88 88 @Test 89 publicvoid testFillModifiedData() {89 void testFillModifiedData() { 90 90 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 91 91 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 103 103 */ 104 104 @Test 105 publicvoid testGetParticipatingPrimitives() {105 void testGetParticipatingPrimitives() { 106 106 RemoveNodesCommand command = new RemoveNodesCommand(testData.existingWay, 107 107 Collections.singleton(testData.existingNode)); … … 114 114 */ 115 115 @Test 116 publicvoid testDescription() {116 void testDescription() { 117 117 assertTrue(new RemoveNodesCommand(testData.existingWay, Collections.singleton(testData.existingNode)) 118 118 .getDescriptionText().matches("Removed nodes from .*")); … … 123 123 */ 124 124 @Test 125 publicvoid testEqualsContract() {125 void testEqualsContract() { 126 126 TestUtils.assumeWorkingEqualsVerifier(); 127 127 EqualsVerifier.forClass(RemoveNodesCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/RotateCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 6 7 7 import java.util.ArrayList; 8 8 import java.util.Arrays; 9 9 10 import org.junit. Before;11 import org.junit. Rule;12 import org.junit. Test;10 import org.junit.jupiter.api.BeforeEach; 11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.extension.RegisterExtension; 13 13 import org.openstreetmap.josm.TestUtils; 14 14 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 29 29 * Unit tests of {@link RotateCommand} class. 30 30 */ 31 publicclass RotateCommandTest {31 class RotateCommandTest { 32 32 33 33 /** 34 34 * We need prefs for nodes. 35 35 */ 36 @R ule36 @RegisterExtension 37 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 38 public JOSMTestRules test = new JOSMTestRules().preferences().projection(); … … 42 42 * Set up the test data. 43 43 */ 44 @Before 44 @BeforeEach 45 45 public void createTestData() { 46 46 testData = new CommandTestData(); … … 51 51 */ 52 52 @Test 53 publicvoid testRotate() {53 void testRotate() { 54 54 // pivot needs to be at 0,0 55 55 Node n1 = new Node(new EastNorth(10, 10)); … … 71 71 */ 72 72 @Test 73 publicvoid testUndo() {73 void testUndo() { 74 74 Node n1 = new Node(new EastNorth(10, 10)); 75 75 Node n2 = new Node(new EastNorth(-1, 0)); … … 96 96 */ 97 97 @Test 98 publicvoid testFillModifiedData() {98 void testFillModifiedData() { 99 99 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 100 100 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 113 113 */ 114 114 @Test 115 publicvoid testGetParticipatingPrimitives() {115 void testGetParticipatingPrimitives() { 116 116 RotateCommand command = new RotateCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0)); 117 117 command.executeCommand(); … … 123 123 */ 124 124 @Test 125 publicvoid testDescription() {125 void testDescription() { 126 126 assertEquals("Rotate 1 node", 127 127 new RotateCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0)) … … 136 136 */ 137 137 @Test 138 publicvoid testEqualsContract() {138 void testEqualsContract() { 139 139 TestUtils.assumeWorkingEqualsVerifier(); 140 140 EqualsVerifier.forClass(RotateCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 6 7 7 import java.util.ArrayList; 8 8 import java.util.Arrays; 9 9 10 import org.junit. Before;11 import org.junit. Rule;12 import org.junit. Test;10 import org.junit.jupiter.api.BeforeEach; 11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.extension.RegisterExtension; 13 13 import org.openstreetmap.josm.TestUtils; 14 14 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 29 29 * Unit tests of {@link ScaleCommand} class. 30 30 */ 31 publicclass ScaleCommandTest {31 class ScaleCommandTest { 32 32 33 33 /** 34 34 * We need prefs for nodes. 35 35 */ 36 @R ule36 @RegisterExtension 37 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 38 public JOSMTestRules test = new JOSMTestRules().preferences().projection(); … … 42 42 * Set up the test data. 43 43 */ 44 @Before 44 @BeforeEach 45 45 public void createTestData() { 46 46 testData = new CommandTestData(); … … 51 51 */ 52 52 @Test 53 publicvoid testScale() {53 void testScale() { 54 54 // pivot needs to be at 0,0 55 55 Node n1 = new Node(new EastNorth(10, 10)); … … 71 71 */ 72 72 @Test 73 publicvoid testUndo() {73 void testUndo() { 74 74 Node n1 = new Node(new EastNorth(10, 10)); 75 75 Node n2 = new Node(new EastNorth(-1, 0)); … … 96 96 */ 97 97 @Test 98 publicvoid testFillModifiedData() {98 void testFillModifiedData() { 99 99 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 100 100 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 113 113 */ 114 114 @Test 115 publicvoid testGetParticipatingPrimitives() {115 void testGetParticipatingPrimitives() { 116 116 ScaleCommand command = new ScaleCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0)); 117 117 command.executeCommand(); … … 123 123 */ 124 124 @Test 125 publicvoid testDescription() {125 void testDescription() { 126 126 assertEquals("Scale 1 node", 127 127 new ScaleCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0)) … … 136 136 */ 137 137 @Test 138 publicvoid testEqualsContract() {138 void testEqualsContract() { 139 139 TestUtils.assumeWorkingEqualsVerifier(); 140 140 EqualsVerifier.forClass(ScaleCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/SelectCommandTest.java
r15324 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit.Assert.assertArrayEquals; 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 9 import java.util.ArrayList; … … 10 11 import java.util.List; 11 12 12 import org.junit. Before;13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.BeforeEach; 14 import org.junit.jupiter.api.Test; 15 import org.junit.jupiter.api.extension.RegisterExtension; 15 16 import org.openstreetmap.josm.TestUtils; 16 17 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 28 29 * Unit tests of {@link SelectCommand} class. 29 30 */ 30 publicclass SelectCommandTest {31 class SelectCommandTest { 31 32 32 33 /** 33 34 * We need prefs for nodes. 34 35 */ 35 @R ule36 @RegisterExtension 36 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 38 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 41 42 * Set up the test data. 42 43 */ 43 @Before 44 @BeforeEach 44 45 public void createTestData() { 45 46 testData = new CommandTestDataWithRelation(); … … 50 51 */ 51 52 @Test 52 publicvoid testExecute() {53 void testExecute() { 53 54 SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode, testData.existingWay)); 54 55 … … 66 67 */ 67 68 @Test 68 publicvoid testExecuteAfterModify() {69 void testExecuteAfterModify() { 69 70 List<OsmPrimitive> list = new ArrayList<>(Arrays.asList(testData.existingNode, testData.existingWay)); 70 71 SelectCommand command = new SelectCommand(testData.layer.getDataSet(), list); … … 84 85 */ 85 86 @Test 86 publicvoid testUndo() {87 void testUndo() { 87 88 SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode, testData.existingWay)); 88 89 testData.layer.getDataSet().setSelected(Arrays.asList(testData.existingNode2)); … … 107 108 */ 108 109 @Test 109 publicvoid testFillModifiedData() {110 void testFillModifiedData() { 110 111 ArrayList<OsmPrimitive> modified = new ArrayList<>(); 111 112 ArrayList<OsmPrimitive> deleted = new ArrayList<>(); … … 123 124 */ 124 125 @Test 125 publicvoid testGetParticipatingPrimitives() {126 void testGetParticipatingPrimitives() { 126 127 SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode)); 127 128 command.executeCommand(); … … 133 134 */ 134 135 @Test 135 publicvoid testDescription() {136 void testDescription() { 136 137 DataSet ds = testData.layer.getDataSet(); 137 138 assertTrue(new SelectCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode)) … … 149 150 */ 150 151 @Test 151 publicvoid testEqualsContract() {152 void testEqualsContract() { 152 153 TestUtils.assumeWorkingEqualsVerifier(); 153 154 EqualsVerifier.forClass(SelectCommand.class).usingGetClass() … … 165 166 * Unit test of {@link SelectCommand#SelectCommand}. 166 167 */ 167 @Test (expected = IllegalArgumentException.class)168 publicvoid testConstructorIAE() {169 new SelectCommand(new DataSet(), Arrays.asList(new OsmPrimitive[] {null})); 168 @Test 169 void testConstructorIAE() { 170 assertThrows(IllegalArgumentException.class, () -> new SelectCommand(new DataSet(), Arrays.asList(new OsmPrimitive[] {null}))); 170 171 } 171 172 } -
trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java
r17087 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit.Assert.assertArrayEquals; 5 import static org.junit.Assert.assertEquals; 6 import static org.junit.Assert.assertFalse; 7 import static org.junit.Assert.assertNotSame; 8 import static org.junit.Assert.assertNull; 9 import static org.junit.Assert.assertSame; 10 import static org.junit.Assert.assertTrue; 11 import static org.junit.Assert.fail; 4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertNotSame; 8 import static org.junit.jupiter.api.Assertions.assertNull; 9 import static org.junit.jupiter.api.Assertions.assertSame; 12 10 import static org.junit.jupiter.api.Assertions.assertThrows; 11 import static org.junit.jupiter.api.Assertions.assertTrue; 12 import static org.junit.jupiter.api.Assertions.fail; 13 13 14 14 import java.io.PrintWriter; … … 19 19 import java.util.Collections; 20 20 21 import org.junit. Before;22 import org.junit. Rule;23 import org.junit. Test;21 import org.junit.jupiter.api.BeforeEach; 22 import org.junit.jupiter.api.Test; 23 import org.junit.jupiter.api.extension.RegisterExtension; 24 24 import org.openstreetmap.josm.TestUtils; 25 25 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 39 39 * Unit tests of {@link SequenceCommand} class. 40 40 */ 41 publicclass SequenceCommandTest {41 class SequenceCommandTest { 42 42 43 43 /** 44 44 * We need prefs for nodes. 45 45 */ 46 @R ule46 @RegisterExtension 47 47 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 48 48 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 52 52 * Set up the test data. 53 53 */ 54 @Before 54 @BeforeEach 55 55 public void createTestData() { 56 56 testData = new CommandTestDataWithRelation(); … … 61 61 */ 62 62 @Test 63 publicvoid testExecute() {63 void testExecute() { 64 64 DataSet ds = new DataSet(); 65 65 final TestCommand command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode)); … … 83 83 */ 84 84 @Test 85 publicvoid testUndo() {85 void testUndo() { 86 86 DataSet ds = new DataSet(); 87 87 final TestCommand command2 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode2)); … … 112 112 */ 113 113 @Test 114 publicvoid testExecuteRollback() {114 void testExecuteRollback() { 115 115 DataSet ds = new DataSet(); 116 116 TestCommand command1 = new TestCommand(ds, null); … … 129 129 */ 130 130 @Test 131 publicvoid testContinueOnErrors() {131 void testContinueOnErrors() { 132 132 DataSet ds = new DataSet(); 133 133 TestCommand command1 = new TestCommand(ds, null); … … 148 148 */ 149 149 @Test 150 publicvoid testGetLastCommand() {150 void testGetLastCommand() { 151 151 DataSet ds = new DataSet(); 152 152 final TestCommand command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode)); … … 161 161 */ 162 162 @Test 163 publicvoid testFillModifiedData() {163 void testFillModifiedData() { 164 164 DataSet ds = new DataSet(); 165 165 Command command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode)); … … 194 194 */ 195 195 @Test 196 publicvoid testGetParticipatingPrimitives() {196 void testGetParticipatingPrimitives() { 197 197 DataSet ds = new DataSet(); 198 198 Command command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode)); … … 211 211 */ 212 212 @Test 213 publicvoid testDescription() {213 void testDescription() { 214 214 assertTrue(new SequenceCommand(new DataSet(), "test", Collections.emptyList(), false).getDescriptionText().matches("Sequence: test")); 215 215 } … … 219 219 */ 220 220 @Test 221 publicvoid testEqualsContract() {221 void testEqualsContract() { 222 222 DataSet ds = new DataSet(); 223 223 TestUtils.assumeWorkingEqualsVerifier(); … … 263 263 @Override 264 264 public boolean executeCommand() { 265 assertFalse("Cannot execute twice" , executed);265 assertFalse(executed, "Cannot execute twice"); 266 266 executed = true; 267 267 return true; … … 270 270 @Override 271 271 public void undoCommand() { 272 assertTrue("Cannot undo without execute" , executed);272 assertTrue(executed, "Cannot undo without execute"); 273 273 executed = false; 274 274 } … … 295 295 @Override 296 296 public void undoCommand() { 297 assertTrue("Cannot undo without execute" , executed);297 assertTrue(executed, "Cannot undo without execute"); 298 298 executed = false; 299 299 } … … 309 309 */ 310 310 @Test 311 publicvoid testWrapIfNeeded() {311 void testWrapIfNeeded() { 312 312 DataSet ds = new DataSet(); 313 313 TestCommand command1 = new TestCommand(ds, Collections.<OsmPrimitive>singletonList(testData.existingNode)); … … 322 322 */ 323 323 @Test 324 publicvoid testCreateReportedException() {324 void testCreateReportedException() { 325 325 DataSet ds = new DataSet(); 326 326 Command c1 = new TestCommand(ds, Collections.emptyList()) { -
trunk/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java
r16782 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.io.IOException; … … 14 14 import java.util.Optional; 15 15 16 import org.junit. Rule;17 import org.junit. Test;16 import org.junit.jupiter.api.Test; 17 import org.junit.jupiter.api.extension.RegisterExtension; 18 18 import org.openstreetmap.josm.TestUtils; 19 19 import org.openstreetmap.josm.command.SplitWayCommand.Strategy; … … 36 36 * Unit tests for class {@link SplitWayCommand}. 37 37 */ 38 publicfinal class SplitWayCommandTest {38 final class SplitWayCommandTest { 39 39 40 40 /** 41 41 * Setup test. 42 42 */ 43 @R ule43 @RegisterExtension 44 44 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 45 45 public JOSMTestRules test = new JOSMTestRules().main().projection().preferences(); … … 49 49 */ 50 50 @Test 51 publicvoid testFindVias() {51 void testFindVias() { 52 52 // empty relation 53 53 assertTrue(SplitWayCommand.findVias(new Relation(), null).isEmpty()); … … 81 81 */ 82 82 @Test 83 publicvoid testRouteRelation() {83 void testRouteRelation() { 84 84 doTestRouteRelation(false, 0); 85 85 doTestRouteRelation(false, 1); … … 149 149 150 150 @Test 151 publicvoid testOneMemberOrderedRelationShowsWarningTest() {151 void testOneMemberOrderedRelationShowsWarningTest() { 152 152 final DataSet dataSet = new DataSet(); 153 153 … … 188 188 189 189 @Test 190 publicvoid testDoIncompleteMembersOrderedRelationCorrectOrderTest() {190 void testDoIncompleteMembersOrderedRelationCorrectOrderTest() { 191 191 for (int i = 0; i < 2; i++) { 192 192 // All these permutations should result in a split that keeps the new parts in order. … … 244 244 245 245 static void assertFirstLastNodeIs(Way way, Node node) { 246 assertTrue("First/last node of " + way + " should be " + node, node.equals(way.firstNode()) || node.equals(way.lastNode())); 246 assertTrue(node.equals(way.firstNode()) || node.equals(way.lastNode()), 247 "First/last node of " + way + " should be " + node); 247 248 } 248 249 … … 253 254 Node last2 = two.lastNode(); 254 255 255 assertTrue( "Ways expected to be connected at their ends.",256 first1 == first2 || first1 == last2 || last1 == first2 || last1 == last2);256 assertTrue(first1 == first2 || first1 == last2 || last1 == first2 || last1 == last2, 257 "Ways expected to be connected at their ends."); 257 258 } 258 259 … … 263 264 */ 264 265 @Test 265 publicvoid testTicket18596() throws IOException, IllegalDataException {266 void testTicket18596() throws IOException, IllegalDataException { 266 267 try (InputStream is = TestUtils.getRegressionDataStream(18596, "data.osm")) { 267 268 DataSet ds = OsmReader.parseDataSet(is, null); … … 280 281 Relation relation = (Relation) ds.getPrimitiveById(8888, OsmPrimitiveType.RELATION); 281 282 282 assertEquals(relation.getMembersCount() , 8);283 assertEquals(8, relation.getMembersCount()); 283 284 284 285 // Before the patch introduced in #18596, these asserts would fail. The two parts of … … 299 300 */ 300 301 @Test 301 publicvoid testTicket17400() throws IOException, IllegalDataException {302 void testTicket17400() throws IOException, IllegalDataException { 302 303 try (InputStream is = TestUtils.getRegressionDataStream(17400, "data.osm")) { 303 304 DataSet ds = OsmReader.parseDataSet(is, null); … … 323 324 324 325 // One more than the original 161. 325 assertEquals(relation.getMembersCount() , 162);326 assertEquals(162, relation.getMembersCount()); 326 327 327 328 // Before the patch introduced in #18596, these asserts would fail. The new parts of … … 347 348 */ 348 349 @Test 349 publicvoid testTicket18863() throws IOException, IllegalDataException {350 void testTicket18863() throws IOException, IllegalDataException { 350 351 try (InputStream is = TestUtils.getRegressionDataStream(18863, "data.osm.bz2")) { 351 352 DataSet ds = OsmReader.parseDataSet(is, null); … … 375 376 */ 376 377 @Test 377 publicvoid testTicket19432() throws IOException, IllegalDataException {378 void testTicket19432() throws IOException, IllegalDataException { 378 379 try (InputStream is = TestUtils.getRegressionDataStream(19432, "josm_split_way_exception_example.osm.bz2")) { 379 380 DataSet ds = OsmReader.parseDataSet(is, null); -
trunk/test/unit/org/openstreetmap/josm/command/TransformNodesCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command; 3 3 4 import org.junit. Rule;5 import org.junit.Test; 4 import org.junit.jupiter.api.extension.RegisterExtension; 5 import org.junit.jupiter.api.Test; 6 6 import org.openstreetmap.josm.TestUtils; 7 7 import org.openstreetmap.josm.data.coor.LatLon; … … 18 18 * Unit tests of {@link TransformNodesCommand} class. 19 19 */ 20 publicclass TransformNodesCommandTest {20 class TransformNodesCommandTest { 21 21 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules(); … … 31 31 */ 32 32 @Test 33 publicvoid testEqualsContract() {33 void testEqualsContract() { 34 34 TestUtils.assumeWorkingEqualsVerifier(); 35 35 EqualsVerifier.forClass(TransformNodesCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.command.conflict; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import org.junit. Before;9 import org.junit. Rule;10 import org.junit. Test;8 import org.junit.jupiter.api.BeforeEach; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.TestUtils; 12 12 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 26 26 * Unit tests of {@link ConflictAddCommand} class. 27 27 */ 28 publicclass ConflictAddCommandTest {28 class ConflictAddCommandTest { 29 29 30 30 /** 31 31 * Setup test. 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules(); … … 39 39 * Setup test. 40 40 */ 41 @Before 41 @BeforeEach 42 42 public void setUp() { 43 43 testData = new CommandTestData(); … … 48 48 */ 49 49 @Test 50 publicvoid testExecuteUndoCommand() {50 void testExecuteUndoCommand() { 51 51 DataSet ds = testData.layer.getDataSet(); 52 52 Conflict<Node> conflict = new Conflict<>(testData.existingNode, testData.existingNode2); … … 64 64 */ 65 65 @Test 66 publicvoid testGetDescriptionIcon() {66 void testGetDescriptionIcon() { 67 67 Conflict<Node> conflict = new Conflict<>(testData.existingNode, testData.existingNode2); 68 68 assertNotNull(new ConflictAddCommand(testData.layer.getDataSet(), conflict).getDescriptionIcon()); … … 73 73 */ 74 74 @Test 75 publicvoid testEqualsContract() {75 void testEqualsContract() { 76 76 TestUtils.assumeWorkingEqualsVerifier(); 77 77 EqualsVerifier.forClass(ConflictAddCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictResolveCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 3 3 4 import org.junit. Rule;5 import org.junit.Test; 4 import org.junit.jupiter.api.extension.RegisterExtension; 5 import org.junit.jupiter.api.Test; 6 6 import org.openstreetmap.josm.TestUtils; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 19 19 * Unit tests of {@link ConflictResolveCommand} class. 20 20 */ 21 publicclass ConflictResolveCommandTest {21 class ConflictResolveCommandTest { 22 22 23 23 /** 24 24 * Setup test. 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules(); … … 32 32 */ 33 33 @Test 34 publicvoid testEqualsContract() {34 void testEqualsContract() { 35 35 TestUtils.assumeWorkingEqualsVerifier(); 36 36 EqualsVerifier.forClass(ConflictResolveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java
r14138 r17275 2 2 package org.openstreetmap.josm.command.conflict; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import org.junit. Before;9 import org.junit. Rule;10 import org.junit. Test;8 import org.junit.jupiter.api.BeforeEach; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.TestUtils; 12 12 import org.openstreetmap.josm.command.CommandTest.CommandTestData; … … 28 28 * Unit tests of {@link CoordinateConflictResolveCommand} class. 29 29 */ 30 publicclass CoordinateConflictResolveCommandTest {30 class CoordinateConflictResolveCommandTest { 31 31 32 32 private CommandTestData testData; … … 35 35 * Setup test. 36 36 */ 37 @R ule37 @RegisterExtension 38 38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 39 39 public JOSMTestRules test = new JOSMTestRules(); … … 42 42 * Setup test. 43 43 */ 44 @Before 44 @BeforeEach 45 45 public void setUp() { 46 46 testData = new CommandTestData(); … … 55 55 */ 56 56 @Test 57 publicvoid testExecuteKeepMineUndoCommand() {57 void testExecuteKeepMineUndoCommand() { 58 58 Conflict<Node> conflict = createConflict(); 59 59 CoordinateConflictResolveCommand cmd = new CoordinateConflictResolveCommand(conflict, MergeDecisionType.KEEP_MINE); … … 68 68 */ 69 69 @Test 70 publicvoid testExecuteKeepTheirUndoCommand() {70 void testExecuteKeepTheirUndoCommand() { 71 71 Conflict<Node> conflict = createConflict(); 72 72 CoordinateConflictResolveCommand cmd = new CoordinateConflictResolveCommand(conflict, MergeDecisionType.KEEP_THEIR); … … 81 81 */ 82 82 @Test 83 publicvoid testGetDescriptionIcon() {83 void testGetDescriptionIcon() { 84 84 Conflict<Node> conflict = createConflict(); 85 85 assertNotNull(new CoordinateConflictResolveCommand(conflict, null).getDescriptionIcon()); … … 90 90 */ 91 91 @Test 92 publicvoid testEqualsContract() {92 void testEqualsContract() { 93 93 TestUtils.assumeWorkingEqualsVerifier(); 94 94 EqualsVerifier.forClass(CoordinateConflictResolveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 3 3 4 import org.junit. Rule;5 import org.junit.Test; 4 import org.junit.jupiter.api.extension.RegisterExtension; 5 import org.junit.jupiter.api.Test; 6 6 import org.openstreetmap.josm.TestUtils; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 20 20 * Unit tests of {@link DeletedStateConflictResolveCommand} class. 21 21 */ 22 publicclass DeletedStateConflictResolveCommandTest {22 class DeletedStateConflictResolveCommandTest { 23 23 24 24 /** 25 25 * Setup test. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 33 33 */ 34 34 @Test 35 publicvoid testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 EqualsVerifier.forClass(DeletedStateConflictResolveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 3 3 4 import org.junit. Rule;5 import org.junit.Test; 4 import org.junit.jupiter.api.extension.RegisterExtension; 5 import org.junit.jupiter.api.Test; 6 6 import org.openstreetmap.josm.TestUtils; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 20 20 * Unit tests of {@link ModifiedConflictResolveCommand} class. 21 21 */ 22 publicclass ModifiedConflictResolveCommandTest {22 class ModifiedConflictResolveCommandTest { 23 23 24 24 /** 25 25 * Setup test. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 33 33 */ 34 34 @Test 35 publicvoid testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 EqualsVerifier.forClass(ModifiedConflictResolveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 3 3 4 import org.junit. Rule;5 import org.junit.Test; 4 import org.junit.jupiter.api.extension.RegisterExtension; 5 import org.junit.jupiter.api.Test; 6 6 import org.openstreetmap.josm.TestUtils; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 20 20 * Unit tests of {@link RelationMemberConflictResolverCommand} class. 21 21 */ 22 publicclass RelationMemberConflictResolverCommandTest {22 class RelationMemberConflictResolverCommandTest { 23 23 24 24 /** 25 25 * Setup test. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 33 33 */ 34 34 @Test 35 publicvoid testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 EqualsVerifier.forClass(RelationMemberConflictResolverCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 3 3 4 import org.junit. Rule;5 import org.junit.Test; 4 import org.junit.jupiter.api.extension.RegisterExtension; 5 import org.junit.jupiter.api.Test; 6 6 import org.openstreetmap.josm.TestUtils; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 20 20 * Unit tests of {@link TagConflictResolveCommand} class. 21 21 */ 22 publicclass TagConflictResolveCommandTest {22 class TagConflictResolveCommandTest { 23 23 24 24 /** 25 25 * Setup test. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 33 33 */ 34 34 @Test 35 publicvoid testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 EqualsVerifier.forClass(TagConflictResolveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 3 3 4 import org.junit. Rule;5 import org.junit.Test; 4 import org.junit.jupiter.api.extension.RegisterExtension; 5 import org.junit.jupiter.api.Test; 6 6 import org.openstreetmap.josm.TestUtils; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 20 20 * Unit tests of {@link VersionConflictResolveCommand} class. 21 21 */ 22 publicclass VersionConflictResolveCommandTest {22 class VersionConflictResolveCommandTest { 23 23 24 24 /** 25 25 * Setup test. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 33 33 */ 34 34 @Test 35 publicvoid testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 EqualsVerifier.forClass(VersionConflictResolveCommand.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.command.conflict; 3 3 4 import org.junit. Rule;5 import org.junit.Test; 4 import org.junit.jupiter.api.extension.RegisterExtension; 5 import org.junit.jupiter.api.Test; 6 6 import org.openstreetmap.josm.TestUtils; 7 7 import org.openstreetmap.josm.data.conflict.Conflict; … … 20 20 * Unit tests of {@link WayNodesConflictResolverCommand} class. 21 21 */ 22 publicclass WayNodesConflictResolverCommandTest {22 class WayNodesConflictResolverCommandTest { 23 23 24 24 /** 25 25 * Setup test. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 33 33 */ 34 34 @Test 35 publicvoid testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 EqualsVerifier.forClass(WayNodesConflictResolverCommand.class).usingGetClass()
Note:
See TracChangeset
for help on using the changeset viewer.
