@Test
public void testOnlyHeadMagic() throws Exception {

  File file = fsFactory.getFile(FILE_NAME);
  TsFileWriter writer = new TsFileWriter(file);
  writer.getIOWriter().close();
  RestorableTsFileIOWriter rWriter = new RestorableTsFileIOWriter(file);
  writer = new TsFileWriter(rWriter);
  writer.close();
  assertEquals(TSFileConfig.MAGIC_STRING.getBytes().length + TSFileConfig.VERSION_NUMBER
      .getBytes().length, rWriter.getTruncatedSize());
  rWriter = new RestorableTsFileIOWriter(file);
  assertEquals(TsFileCheckStatus.COMPLETE_FILE, rWriter.getTruncatedSize());
  assertFalse(rWriter.canWrite());
  rWriter.close();
  assertTrue(file.delete());
}