kopia lustrzana https://github.com/JOSM/MapWithAI
Remove a suppress warning annotation and fix the root cause
Signed-off-by: Taylor Smock <taylor.smock@kaart.com>pull/1/head
rodzic
d86f126818
commit
b8ad1c37f4
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
|
@ -33,7 +34,6 @@ public class AddPrimitivesCommandTest {
|
||||||
Assert.assertSame(dataSet, way1.getDataSet());
|
Assert.assertSame(dataSet, way1.getDataSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("UndefinedEquals")
|
|
||||||
@Test
|
@Test
|
||||||
public void testUndoRedo() {
|
public void testUndoRedo() {
|
||||||
final DataSet dataSet = new DataSet();
|
final DataSet dataSet = new DataSet();
|
||||||
|
@ -49,19 +49,19 @@ public class AddPrimitivesCommandTest {
|
||||||
command.executeCommand();
|
command.executeCommand();
|
||||||
command.fillModifiedData(modified, deleted, added);
|
command.fillModifiedData(modified, deleted, added);
|
||||||
Assert.assertSame(dataSet, way1.getDataSet());
|
Assert.assertSame(dataSet, way1.getDataSet());
|
||||||
Assert.assertEquals(selection, dataSet.getAllSelected());
|
Assert.assertEquals(new TreeSet<>(selection), new TreeSet<>(dataSet.getAllSelected()));
|
||||||
Assert.assertTrue(deleted.isEmpty());
|
Assert.assertTrue(deleted.isEmpty());
|
||||||
Assert.assertTrue(modified.isEmpty());
|
Assert.assertTrue(modified.isEmpty());
|
||||||
Assert.assertEquals(3, added.size());
|
Assert.assertEquals(3, added.size());
|
||||||
|
|
||||||
command.undoCommand();
|
command.undoCommand();
|
||||||
Assert.assertNull(way1.getDataSet());
|
Assert.assertNull(way1.getDataSet());
|
||||||
Assert.assertEquals(selection, dataSet.getAllSelected());
|
Assert.assertEquals(new TreeSet<>(selection), new TreeSet<>(dataSet.getAllSelected()));
|
||||||
|
|
||||||
added.clear();
|
added.clear();
|
||||||
command.executeCommand();
|
command.executeCommand();
|
||||||
Assert.assertSame(dataSet, way1.getDataSet());
|
Assert.assertSame(dataSet, way1.getDataSet());
|
||||||
Assert.assertEquals(selection, dataSet.getAllSelected());
|
Assert.assertEquals(new TreeSet<>(selection), new TreeSet<>(dataSet.getAllSelected()));
|
||||||
command.fillModifiedData(modified, deleted, added);
|
command.fillModifiedData(modified, deleted, added);
|
||||||
Assert.assertTrue(deleted.isEmpty());
|
Assert.assertTrue(deleted.isEmpty());
|
||||||
Assert.assertTrue(modified.isEmpty());
|
Assert.assertTrue(modified.isEmpty());
|
||||||
|
@ -73,26 +73,26 @@ public class AddPrimitivesCommandTest {
|
||||||
|
|
||||||
command.executeCommand();
|
command.executeCommand();
|
||||||
Assert.assertSame(dataSet, way1.getDataSet());
|
Assert.assertSame(dataSet, way1.getDataSet());
|
||||||
Assert.assertNotEquals(selection, dataSet.getAllSelected());
|
Assert.assertNotEquals(new TreeSet<>(selection), new TreeSet<>(dataSet.getAllSelected()));
|
||||||
|
|
||||||
command.undoCommand();
|
command.undoCommand();
|
||||||
Assert.assertNull(way1.getDataSet());
|
Assert.assertNull(way1.getDataSet());
|
||||||
Assert.assertEquals(selection, dataSet.getAllSelected());
|
Assert.assertEquals(new TreeSet<>(selection), new TreeSet<>(dataSet.getAllSelected()));
|
||||||
|
|
||||||
dataSet.addPrimitive(way1.firstNode());
|
dataSet.addPrimitive(way1.firstNode());
|
||||||
command.executeCommand();
|
command.executeCommand();
|
||||||
Assert.assertSame(dataSet, way1.getDataSet());
|
Assert.assertSame(dataSet, way1.getDataSet());
|
||||||
Assert.assertNotEquals(selection, dataSet.getAllSelected());
|
Assert.assertNotEquals(new TreeSet<>(selection), new TreeSet<>(dataSet.getAllSelected()));
|
||||||
|
|
||||||
command.undoCommand();
|
command.undoCommand();
|
||||||
Assert.assertNull(way1.getDataSet());
|
Assert.assertNull(way1.getDataSet());
|
||||||
Assert.assertEquals(selection, dataSet.getAllSelected());
|
Assert.assertEquals(new TreeSet<>(selection), new TreeSet<>(dataSet.getAllSelected()));
|
||||||
|
|
||||||
dataSet.addPrimitive(way1.lastNode());
|
dataSet.addPrimitive(way1.lastNode());
|
||||||
dataSet.addPrimitive(way1);
|
dataSet.addPrimitive(way1);
|
||||||
command.executeCommand();
|
command.executeCommand();
|
||||||
Assert.assertSame(dataSet, way1.getDataSet());
|
Assert.assertSame(dataSet, way1.getDataSet());
|
||||||
Assert.assertNotEquals(selection, dataSet.getAllSelected());
|
Assert.assertNotEquals(new TreeSet<>(selection), new TreeSet<>(dataSet.getAllSelected()));
|
||||||
|
|
||||||
command.undoCommand();
|
command.undoCommand();
|
||||||
Assert.assertSame(dataSet, way1.getDataSet());
|
Assert.assertSame(dataSet, way1.getDataSet());
|
||||||
|
@ -102,7 +102,7 @@ public class AddPrimitivesCommandTest {
|
||||||
new DataSet().addPrimitive(way1.lastNode());
|
new DataSet().addPrimitive(way1.lastNode());
|
||||||
command.executeCommand();
|
command.executeCommand();
|
||||||
Assert.assertNull(way1.getDataSet());
|
Assert.assertNull(way1.getDataSet());
|
||||||
Assert.assertEquals(selection, dataSet.getAllSelected());
|
Assert.assertEquals(new TreeSet<>(selection), new TreeSet<>(dataSet.getAllSelected()));
|
||||||
|
|
||||||
command.undoCommand();
|
command.undoCommand();
|
||||||
Assert.assertNull(way1.getDataSet());
|
Assert.assertNull(way1.getDataSet());
|
||||||
|
|
Ładowanie…
Reference in New Issue