Changeset 9711 in josm for trunk/test


Ignore:
Timestamp:
2016-02-01T23:47:27+01:00 (4 years ago)
Author:
simon04
Message:

see #12300 - Provide wrapper classes for transfer data to avoid unchecked casts

Location:
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/PrimitiveTransferableTest.java

    r9669 r9711  
    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.PrimitiveTransferable.PRIMITIVE_DATA;
     
    5756     */
    5857    @Test
    59     @SuppressWarnings("unchecked")
    6058    public void testGetTransferDataNominal() throws UnsupportedFlavorException {
    6159        PrimitiveTransferable pt = new PrimitiveTransferable(Collections.singleton(new Node(1)));
    6260        assertEquals("node 1 # incomplete\n", pt.getTransferData(DataFlavor.stringFlavor));
    63         Collection<PrimitiveData> td = (Collection<PrimitiveData>) pt.getTransferData(PRIMITIVE_DATA);
     61        Collection<PrimitiveData> td = ((PrimitiveTransferable.Data) pt.getTransferData(PRIMITIVE_DATA)).getPrimitiveData();
    6462        assertEquals(1, td.size());
    65         assertNotNull(td.iterator().next());
     63        assertTrue(td.iterator().next() instanceof PrimitiveData);
    6664    }
    6765
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/RelationMemberTransferableTest.java

    r9669 r9711  
    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;
     
    1716import org.openstreetmap.josm.JOSMFixture;
    1817import org.openstreetmap.josm.data.osm.Node;
    19 import org.openstreetmap.josm.data.osm.PrimitiveData;
    2018import org.openstreetmap.josm.data.osm.RelationMember;
     19import org.openstreetmap.josm.data.osm.RelationMemberData;
    2120
    2221/**
     
    5857     */
    5958    @Test
    60     @SuppressWarnings("unchecked")
    6159    public void testGetTransferDataNominal() throws UnsupportedFlavorException {
    6260        RelationMemberTransferable rmt = new RelationMemberTransferable(Collections.singleton(new RelationMember("test", new Node(1))));
    6361        assertEquals("node 1 test # incomplete\n", rmt.getTransferData(DataFlavor.stringFlavor));
    64         Collection<PrimitiveData> td = (Collection<PrimitiveData>) rmt.getTransferData(RELATION_MEMBER_DATA);
     62        Collection<RelationMemberData> td = ((RelationMemberTransferable.Data) rmt.getTransferData(RELATION_MEMBER_DATA)).getRelationMemberData();
    6563        assertEquals(1, td.size());
    66         assertNotNull(td.iterator().next());
     64        assertTrue(td.iterator().next() instanceof RelationMemberData);
    6765    }
    6866
Note: See TracChangeset for help on using the changeset viewer.