@Test
public void testCompressionRatio() throws IOException {

  double compressionRatioSum = 0;
  int calcuTimes = 0;
  if (new File(directory, String.format(Locale.ENGLISH, CompressionRatio.RATIO_FILE_PATH_FORMAT, compressionRatioSum , calcuTimes)).exists()) {
    fail();
  }
  double compressionRatio = 10;
  for(int i = 0; i < 500 ; i+= compressionRatio){
    this.compressionRatio.updateRatio(compressionRatio);
    if (new File(directory, String.format(Locale.ENGLISH, CompressionRatio.RATIO_FILE_PATH_FORMAT, compressionRatioSum , calcuTimes)).exists()) {
      fail();
    }
    calcuTimes++;
    compressionRatioSum += compressionRatio;
    if (!new File(directory, String.format(Locale.ENGLISH, CompressionRatio.RATIO_FILE_PATH_FORMAT, compressionRatioSum , calcuTimes)).exists()) {
      fail();
    }
    assertEquals(0, Double
        .compare(compressionRatioSum / calcuTimes, this.compressionRatio.getRatio()));
  }
}