Changeset 9225 in josm for trunk/test


Ignore:
Timestamp:
2015-12-31T01:38:22+01:00 (9 years ago)
Author:
Don-vip
Message:

add more unit tests

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java

    r8857 r9225  
    1111import java.util.Set;
    1212
     13import nl.jqno.equalsverifier.EqualsVerifier;
     14
    1315import org.junit.BeforeClass;
    1416import org.junit.Test;
     
    1618import org.openstreetmap.josm.TestUtils;
    1719import org.openstreetmap.josm.actions.CombineWayAction.NodeGraph;
     20import org.openstreetmap.josm.actions.CombineWayAction.NodePair;
    1821import org.openstreetmap.josm.data.osm.DataSet;
    1922import org.openstreetmap.josm.data.osm.Node;
     
    5558        }
    5659    }
     60
     61    /**
     62     * Unit test of methods {@link NodePair#equals} and {@link NodePair#hashCode}.
     63     */
     64    @Test
     65    public void equalsContract() {
     66        EqualsVerifier.forClass(NodePair.class).usingGetClass()
     67            .withPrefabValues(Node.class, new Node(1), new Node(2))
     68            .verify();
     69    }
    5770}
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java

    r8917 r9225  
    55import static org.junit.Assert.assertNotNull;
    66import static org.junit.Assert.assertTrue;
     7import nl.jqno.equalsverifier.EqualsVerifier;
     8import nl.jqno.equalsverifier.Warning;
    79
    810import org.junit.BeforeClass;
     
    1315import org.openstreetmap.josm.data.osm.DataSet;
    1416import org.openstreetmap.josm.data.osm.Node;
     17import org.openstreetmap.josm.data.osm.Way;
    1518import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1619
     
    5457        assertNotNull(new ConflictAddCommand(layer, conflict).getDescriptionIcon());
    5558    }
     59
     60    /**
     61     * Unit test of methods {@link ConflictAddCommand#equals} and {@link ConflictAddCommand#hashCode}.
     62     */
     63    @Test
     64    public void equalsContract() {
     65        EqualsVerifier.forClass(ConflictAddCommand.class).usingGetClass()
     66            .withPrefabValues(Conflict.class,
     67                    new Conflict<>(new Node(), new Node()), new Conflict<>(new Way(), new Way()))
     68            .withPrefabValues(OsmDataLayer.class,
     69                    new OsmDataLayer(new DataSet(), "1", null), new OsmDataLayer(new DataSet(), "2", null))
     70            .suppress(Warning.NONFINAL_FIELDS)
     71            .verify();
     72    }
    5673}
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java

    r8917 r9225  
    55import static org.junit.Assert.assertNotNull;
    66import static org.junit.Assert.assertTrue;
     7import nl.jqno.equalsverifier.EqualsVerifier;
     8import nl.jqno.equalsverifier.Warning;
    79
    810import org.junit.BeforeClass;
     
    1416import org.openstreetmap.josm.data.osm.DataSet;
    1517import org.openstreetmap.josm.data.osm.Node;
     18import org.openstreetmap.josm.data.osm.Way;
    1619import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
    1720import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    6972        assertNotNull(new CoordinateConflictResolveCommand(conflict, null).getDescriptionIcon());
    7073    }
     74
     75    /**
     76     * Unit test of methods {@link CoordinateConflictResolveCommand#equals} and {@link CoordinateConflictResolveCommand#hashCode}.
     77     */
     78    @Test
     79    public void equalsContract() {
     80        EqualsVerifier.forClass(CoordinateConflictResolveCommand.class).usingGetClass()
     81            .withPrefabValues(Conflict.class,
     82                    new Conflict<>(new Node(), new Node()), new Conflict<>(new Way(), new Way()))
     83            .withPrefabValues(OsmDataLayer.class,
     84                    new OsmDataLayer(new DataSet(), "1", null), new OsmDataLayer(new DataSet(), "2", null))
     85            .suppress(Warning.NONFINAL_FIELDS)
     86            .verify();
     87    }
    7188}
  • trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java

    r9220 r9225  
    2929        Main.logLevel = 5; // enable trace for line coverage
    3030        assertEquals(def, OAuthParameters.createDefault("wrong_url"));
     31        OAuthParameters dev2 = new OAuthParameters(dev);
     32        assertEquals(dev, dev2);
    3133    }
    3234
Note: See TracChangeset for help on using the changeset viewer.