Ticket #13199: patch-fix-relation-member-transferable-test.patch

File patch-fix-relation-member-transferable-test.patch, 3.0 KB (added by michael2402, 5 years ago)
  • test/unit/org/openstreetmap/josm/gui/datatransfer/RelationMemberTransferableTest.java

    diff --git a/test/unit/org/openstreetmap/josm/gui/datatransfer/RelationMemberTransferableTest.java b/test/unit/org/openstreetmap/josm/gui/datatransfer/RelationMemberTransferableTest.java
    index 1fa90e5..6a80442 100644
    a b package org.openstreetmap.josm.gui.datatransfer; 
    33
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNotNull;
    76import static org.junit.Assert.assertTrue;
    87import static org.openstreetmap.josm.gui.datatransfer.RelationMemberTransferable.RELATION_MEMBER_DATA;
    98
    import org.junit.BeforeClass; 
    1615import org.junit.Test;
    1716import org.openstreetmap.josm.JOSMFixture;
    1817import org.openstreetmap.josm.data.osm.Node;
     18import org.openstreetmap.josm.data.osm.PrimitiveData;
    1919import org.openstreetmap.josm.data.osm.RelationMember;
    2020import org.openstreetmap.josm.data.osm.RelationMemberData;
     21import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
    2122
    2223/**
    2324 * Unit tests of {@link RelationMemberTransferable} class.
    public class RelationMemberTransferableTest { 
    3839    @Test
    3940    public void testGetTransferDataFlavors() {
    4041        DataFlavor[] flavors = new RelationMemberTransferable(Collections.<RelationMember>emptyList()).getTransferDataFlavors();
    41         assertEquals(2, flavors.length);
     42        assertEquals(3, flavors.length);
    4243        assertEquals(RELATION_MEMBER_DATA, flavors[0]);
    43         assertEquals(DataFlavor.stringFlavor, flavors[1]);
     44        assertEquals(PrimitiveTransferData.DATA_FLAVOR, flavors[1]);
     45        assertEquals(DataFlavor.stringFlavor, flavors[2]);
    4446    }
    4547
    4648    /**
    public class RelationMemberTransferableTest { 
    5052    public void testIsDataFlavorSupported() {
    5153        RelationMemberTransferable transferable = new RelationMemberTransferable(Collections.<RelationMember>emptyList());
    5254        assertTrue(transferable.isDataFlavorSupported(RELATION_MEMBER_DATA));
     55        assertTrue(transferable.isDataFlavorSupported(PrimitiveTransferData.DATA_FLAVOR));
    5356        assertFalse(transferable.isDataFlavorSupported(null));
    5457    }
    5558
    public class RelationMemberTransferableTest { 
    6467        Collection<RelationMemberData> td = ((RelationMemberTransferable.Data) rmt.getTransferData(RELATION_MEMBER_DATA))
    6568                .getRelationMemberData();
    6669        assertEquals(1, td.size());
    67         assertNotNull(td.iterator().next());
     70        assertEquals(1, td.iterator().next().getMemberId());
     71        assertEquals("test", td.iterator().next().getRole());
     72
     73        Collection<PrimitiveData> primitives = ((PrimitiveTransferData) rmt.getTransferData(PrimitiveTransferData.DATA_FLAVOR))
     74                .getDirectlyAdded();
     75        assertEquals(1, primitives.size());
     76        assertEquals(1, primitives.iterator().next().getId());
    6877    }
    6978
    7079    /**