src/test/java/de/blau/android/osm/StorageDelegatorTest.java
/**
     * Test removeWayNode method, by invoking removeNode on a node that is member of a way(s)
     */
Test removeWayNode method, by invoking removeNode on a node that is member of a way(s)
Test removeWayNode method by invoking removeNode on a node that is member of a way ( s )
@Test
    public void removeWayNode() {
        StorageDelegator d = new StorageDelegator();
        Way w = DelegatorUtil.addWayToStorage(d, false);
        Way temp = (Way) d.getOsmElement(Way.NAME, w.getOsmId());
        assertNotNull(temp);
        Node n = w.getNodes().get(2);
        List<Result> splitResult = d.splitAtNode(w, n);
        assertNotNull(splitResult);
        assertFalse(splitResult.isEmpty());
        Way newWay = (Way) splitResult.get(0).getElement();
        assertEquals(n, w.getLastNode());
        assertEquals(n, newWay.getFirstNode());
        assertEquals(2, newWay.nodeCount());
        d.removeNode(n);
        assertNotNull(d.getOsmElement(Way.NAME, w.getOsmId()));
        assertNull(d.getOsmElement(Way.NAME, newWay.getOsmId()));
        assertFalse(w.hasNode(n));
         remove closing node of a closed way
        d = new StorageDelegator();
        w = DelegatorUtil.addWayToStorage(d, true);
        n = w.getFirstNode();
        d.removeNode(n);
        assertTrue(w.isClosed());
        assertFalse(w.hasNode(n));
    }
@ Test public void removeWayNode ( ) { StorageDelegator d = new StorageDelegator ( ) ; Way w = DelegatorUtil . addWayToStorage ( d , false ) ; Way temp = ( Way ) d . getOsmElement ( Way . NAME , w . getOsmId ( ) ) ; assertNotNull ( temp ) ; Node n = w . getNodes ( ) . get ( 2 ) ; List < Result > splitResult = d . splitAtNode ( w , n ) ; assertNotNull ( splitResult ) ; assertFalse ( splitResult . isEmpty ( ) ) ; Way newWay = ( Way ) splitResult . get ( 0 ) . getElement ( ) ; assertEquals ( n , w . getLastNode ( ) ) ; assertEquals ( n , newWay . getFirstNode ( ) ) ; assertEquals ( 2 , newWay . nodeCount ( ) ) ; d . removeNode ( n ) ; assertNotNull ( d . getOsmElement ( Way . NAME , w . getOsmId ( ) ) ) ; assertNull ( d . getOsmElement ( Way . NAME , newWay . getOsmId ( ) ) ) ; assertFalse ( w . hasNode ( n ) ) ; d = new StorageDelegator ( ) ; w = DelegatorUtil . addWayToStorage ( d , true ) ; n = w . getFirstNode ( ) ; d . removeNode ( n ) ; assertTrue ( w . isClosed ( ) ) ; assertFalse ( w . hasNode ( n ) ) ; }
Test removeWayNode method, by invoking removeNode on a node that is member of a way(s)
Test removeWayNode method by invoking removeNode on a node that is member of a way ( s )
// // remove closing node of a closed way