}
public void testEdges() {
Map<IntWritable, DoubleWritable> edgeMap = Maps.newHashMap();
for (int i = 1000; i > 0; --i) {
edgeMap.put(new IntWritable(i), new DoubleWritable(i * 2.0));
}
vertex.initialize(null, null, edgeMap, null);
assertEquals(vertex.getNumOutEdges(), 1000);
int expectedIndex = 1;
for (IntWritable index : vertex) {
assertEquals(index.get(), expectedIndex);
assertEquals(vertex.getEdgeValue(index).get(),
expectedIndex * 2.0d);
++expectedIndex;
}
assertEquals(vertex.removeEdge(new IntWritable(500)),
new DoubleWritable(1000));
assertEquals(vertex.getNumOutEdges(), 999);
}