private static void testCompression(CompressionMethod compressionMethod) throws IOException {
    String text = StringUtils.repeat("This is a test. ", 100000);

    File file = new File("compressed" + compressionMethod.getExtension());

    OutputStream os = CompressionUtils.getOutputStream(file);
    os.write(text.getBytes());
    os.close();
    InputStream is = CompressionUtils.getInputStream(file.getPath(), new FileInputStream(file));
    assertEquals(text, IOUtils.toString(is));
    is.close();
    file.delete();
  }
  @Test
  public void testPrintWriter() throws IOException {
    CompressionMethod compressionMethod = CompressionMethod.XZ;
    String text = StringUtils.repeat("This is a test. ", 100000);
    File file = new File("compressed" + compressionMethod.getExtension());
    PrintWriter printWriter = new PrintWriter(CompressionUtils.getOutputStream(file));

    printWriter.write(text);
    printWriter.close();

    InputStream is = CompressionUtils.getInputStream(file.getPath(), new FileInputStream(file));
    assertEquals(text, IOUtils.toString(is));
    is.close();
    file.delete();
  }