@Test
public void testSnappyCompressionSimple() throws IOException
{

  if (checkNativeSnappy()) {
    return;
  }
  File snappyFile = new File(testMeta.getDir(), "snappyTestFile.snappy");
  BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(snappyFile));
  Configuration conf = new Configuration();
  CompressionCodec codec = (CompressionCodec)ReflectionUtils.newInstance(SnappyCodec.class, conf);
  FilterStreamCodec.SnappyFilterStream filterStream = new FilterStreamCodec.SnappyFilterStream(
      codec.createOutputStream(os));
  int ONE_MB = 1024 * 1024;
  String testStr = "TestSnap-16bytes";
  for (int i = 0; i < ONE_MB; i++) { // write 16 MBs
    filterStream.write(testStr.getBytes());
  }
  filterStream.flush();
  filterStream.close();
  CompressionInputStream is = codec.createInputStream(new FileInputStream(snappyFile));
  byte[] recovered = new byte[testStr.length()];
  int bytesRead = is.read(recovered);
  is.close();
  assertEquals(testStr, new String(recovered));
}