@Test
public void testSave() throws Exception {

  Configuration conf = getConfiguration();
  Writable key = new IntWritable(0);
  Vector value = new DenseVector(VECTOR);
  Path path = getTestTempDirPath("output");
  
  // write the vector out
  VectorCache.save(key, value, path, conf, true, true);
  
  // can we read it from here?
  SequenceFileValueIterator<VectorWritable> iterator =
      new SequenceFileValueIterator<VectorWritable>(path, true, conf);
  try {
    VectorWritable old = iterator.next();
    // test if the values are identical
    assertEquals("Saved vector is identical to original", old.get(), value);
  } finally {
    Closeables.close(iterator, true);
  }
}