1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.command;
|
---|
3 |
|
---|
4 | import org.junit.BeforeClass;
|
---|
5 | import org.junit.Test;
|
---|
6 | import org.openstreetmap.josm.JOSMFixture;
|
---|
7 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
8 | import org.openstreetmap.josm.data.osm.Node;
|
---|
9 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
10 | import org.openstreetmap.josm.data.osm.User;
|
---|
11 | import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
---|
12 |
|
---|
13 | import nl.jqno.equalsverifier.EqualsVerifier;
|
---|
14 | import nl.jqno.equalsverifier.Warning;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Unit tests of {@link ChangeCommand} class.
|
---|
18 | */
|
---|
19 | public class ChangeCommandTest {
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * Setup test.
|
---|
23 | */
|
---|
24 | @BeforeClass
|
---|
25 | public static void setUpBeforeClass() {
|
---|
26 | JOSMFixture.createUnitTestFixture().init(false);
|
---|
27 | }
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Unit test of methods {@link ChangeCommand#equals} and {@link ChangeCommand#hashCode}.
|
---|
31 | */
|
---|
32 | @Test
|
---|
33 | public void equalsContract() {
|
---|
34 | EqualsVerifier.forClass(ChangeCommand.class).usingGetClass()
|
---|
35 | .withPrefabValues(DataSet.class,
|
---|
36 | new DataSet(), new DataSet())
|
---|
37 | .withPrefabValues(User.class,
|
---|
38 | User.createOsmUser(1, "foo"), User.createOsmUser(2, "bar"))
|
---|
39 | .withPrefabValues(OsmPrimitive.class,
|
---|
40 | new Node(1), new Node(2))
|
---|
41 | .withPrefabValues(OsmDataLayer.class,
|
---|
42 | new OsmDataLayer(new DataSet(), "1", null), new OsmDataLayer(new DataSet(), "2", null))
|
---|
43 | .suppress(Warning.NONFINAL_FIELDS)
|
---|
44 | .verify();
|
---|
45 | }
|
---|
46 | }
|
---|