Ignore:
Timestamp:
2016-10-09T04:03:32+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S1871 - Two branches in the same conditional structure should not have exactly the same implementation

Location:
trunk/test/unit/org/openstreetmap/josm/actions
Files:
1 added
1 edited

Legend:

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

    r11108 r11109  
    33
    44import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertNull;
    56
    67import java.util.Arrays;
     
    4647
    4748    /**
    48      * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - mode 0
     49     * Unit test of {@link MergeNodesAction#selectTargetLocationNode}
    4950     */
    5051    @Test
    51     public void testSelectTargetLocationNodeMode0() {
     52    public void testSelectTargetLocationNode() {
    5253        Main.pref.putInteger("merge-nodes.mode", 0);
    5354        assertEquals(1, MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1))).getId());
    54     }
    5555
    56     /**
    57      * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - mode 1
    58      */
    59     @Test
    60     public void testSelectTargetLocationNodeMode1() {
    6156        Main.pref.putInteger("merge-nodes.mode", 1);
    6257        assertEquals(LatLon.ZERO, MergeNodesAction.selectTargetLocationNode(
    6358                Arrays.asList(new Node(LatLon.NORTH_POLE), new Node(LatLon.SOUTH_POLE))).getCoor());
    64     }
    6559
    66     /**
    67      * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - mode 2 with a single node
    68      */
    69     @Test
    70     public void testSelectTargetLocationNodeMode2SingleNode() {
    7160        Main.pref.putInteger("merge-nodes.mode", 2);
    7261        assertEquals(LatLon.NORTH_POLE, MergeNodesAction.selectTargetLocationNode(
    7362                Arrays.asList(new Node(LatLon.NORTH_POLE))).getCoor());
    7463    }
     64
     65    /**
     66     * Unit test of {@link MergeNodesAction#selectTargetNode}
     67     */
     68    @Test
     69    public void testSelectTargetNode() {
     70        assertNull(MergeNodesAction.selectTargetNode(Collections.emptyList()));
     71        assertEquals(1, MergeNodesAction.selectTargetNode(Arrays.asList(new Node(1))).getId());
     72    }
    7573}
Note: See TracChangeset for help on using the changeset viewer.