@Test
  public void testCopyProperties() {
    graph = createGraph();
    EdgeIteratorState edge =
        graph.edge(1, 3, 10, false).setName("testing").setWayGeometry(Helper.createPointList(1, 2));

    EdgeIteratorState newEdge = graph.edge(1, 3, 10, false);
    edge.copyPropertiesTo(newEdge);
    assertEquals(edge.getName(), newEdge.getName());
    assertEquals(edge.getDistance(), newEdge.getDistance(), 1e-7);
    assertEquals(edge.getFlags(), newEdge.getFlags());
    assertEquals(edge.fetchWayGeometry(0), newEdge.fetchWayGeometry(0));
  }
 @Test
 public void testInfinityWeight() {
   graph = createGraph();
   EdgeIteratorState edge = graph.edge(0, 1);
   edge.setDistance(Double.POSITIVE_INFINITY);
   assertTrue(Double.isInfinite(edge.getDistance()));
 }
  @Test
  public void testCreateDuplicateEdges() {
    graph = createGraph();
    graph.edge(2, 1, 12, true);
    graph.edge(2, 3, 12, true);
    graph.edge(2, 3, 13, false);
    assertEquals(3, GHUtility.count(carOutExplorer.setBaseNode(2)));

    // no exception
    graph.getEdgeProps(1, 3);

    // raise exception
    try {
      graph.getEdgeProps(4, 3);
      assertTrue(false);
    } catch (Exception ex) {
    }
    try {
      graph.getEdgeProps(-1, 3);
      assertTrue(false);
    } catch (Exception ex) {
    }

    EdgeIterator iter = carOutExplorer.setBaseNode(2);
    assertTrue(iter.next());
    EdgeIteratorState oneIter = graph.getEdgeProps(iter.getEdge(), 3);
    assertEquals(13, oneIter.getDistance(), 1e-6);
    assertEquals(2, oneIter.getBaseNode());
    assertTrue(carEncoder.isBool(oneIter.getFlags(), FlagEncoder.K_FORWARD));
    assertFalse(carEncoder.isBool(oneIter.getFlags(), FlagEncoder.K_BACKWARD));

    oneIter = graph.getEdgeProps(iter.getEdge(), 2);
    assertEquals(13, oneIter.getDistance(), 1e-6);
    assertEquals(3, oneIter.getBaseNode());
    assertFalse(carEncoder.isBool(oneIter.getFlags(), FlagEncoder.K_FORWARD));
    assertTrue(carEncoder.isBool(oneIter.getFlags(), FlagEncoder.K_BACKWARD));

    graph.edge(3, 2, 14, true);
    assertEquals(4, GHUtility.count(carOutExplorer.setBaseNode(2)));
  }
  @Test
  public void testEdgeProperties() {
    graph = createGraph();
    EdgeIteratorState iter1 = graph.edge(0, 1, 10, true);
    EdgeIteratorState iter2 = graph.edge(0, 2, 20, true);

    int edgeId = iter1.getEdge();
    EdgeIteratorState iter = graph.getEdgeProps(edgeId, 0);
    assertEquals(10, iter.getDistance(), 1e-5);

    edgeId = iter2.getEdge();
    iter = graph.getEdgeProps(edgeId, 0);
    assertEquals(2, iter.getBaseNode());
    assertEquals(0, iter.getAdjNode());
    assertEquals(20, iter.getDistance(), 1e-5);

    iter = graph.getEdgeProps(edgeId, 2);
    assertEquals(0, iter.getBaseNode());
    assertEquals(2, iter.getAdjNode());
    assertEquals(20, iter.getDistance(), 1e-5);

    iter = graph.getEdgeProps(edgeId, Integer.MIN_VALUE);
    assertFalse(iter == null);
    assertEquals(0, iter.getBaseNode());
    assertEquals(2, iter.getAdjNode());
    iter = graph.getEdgeProps(edgeId, 1);
    assertTrue(iter == null);

    // delete
    graph.markNodeRemoved(1);
    graph.optimize();

    // throw exception if accessing deleted edge
    try {
      graph.getEdgeProps(iter1.getEdge(), -1);
      assertTrue(false);
    } catch (Exception ex) {
    }
  }