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.conflict.Conflict;
|
---|
8 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
9 | import org.openstreetmap.josm.data.osm.Hash;
|
---|
10 | import org.openstreetmap.josm.data.osm.Node;
|
---|
11 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
12 | import org.openstreetmap.josm.data.osm.Storage;
|
---|
13 | import org.openstreetmap.josm.data.osm.User;
|
---|
14 | import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
---|
15 |
|
---|
16 | import nl.jqno.equalsverifier.EqualsVerifier;
|
---|
17 | import nl.jqno.equalsverifier.Warning;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Unit tests of {@link PurgeCommand} class.
|
---|
21 | */
|
---|
22 | public class PurgeCommandTest {
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Setup test.
|
---|
26 | */
|
---|
27 | @BeforeClass
|
---|
28 | public static void setUpBeforeClass() {
|
---|
29 | JOSMFixture.createUnitTestFixture().init(false);
|
---|
30 | }
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Unit test of methods {@link PurgeCommand#equals} and {@link PurgeCommand#hashCode}.
|
---|
34 | */
|
---|
35 | @Test
|
---|
36 | public void equalsContract() {
|
---|
37 | EqualsVerifier.forClass(PurgeCommand.class).usingGetClass()
|
---|
38 | .withPrefabValues(DataSet.class,
|
---|
39 | new DataSet(), new DataSet())
|
---|
40 | .withPrefabValues(User.class,
|
---|
41 | User.createOsmUser(1, "foo"), User.createOsmUser(2, "bar"))
|
---|
42 | .withPrefabValues(Conflict.class,
|
---|
43 | new Conflict<>(new Node(1, 1), new Node(2, 1)),
|
---|
44 | new Conflict<>(new Node(1, 1), new Node(3, 1)))
|
---|
45 | .withPrefabValues(OsmDataLayer.class,
|
---|
46 | new OsmDataLayer(new DataSet(), "1", null), new OsmDataLayer(new DataSet(), "2", null))
|
---|
47 | .withPrefabValues(Hash.class,
|
---|
48 | Storage.<OsmPrimitive>defaultHash(), Storage.<OsmPrimitive>defaultHash())
|
---|
49 | .suppress(Warning.NONFINAL_FIELDS)
|
---|
50 | .verify();
|
---|
51 | }
|
---|
52 | }
|
---|