### Question:
CompressUtil { public static byte[] compressGZip(byte[] data) throws IOException { if (data == null) { return null; } byte[] bytes; ByteArrayOutputStream bos = new ByteArrayOutputStream(); GZIPOutputStream gzip = null; try { gzip = new GZIPOutputStream(bos); gzip.write(data); gzip.finish(); bytes = bos.toByteArray(); } finally { if (gzip != null) { gzip.close(); } bos.close(); } return bytes; }  static byte[] compressGZip(byte[] data); static byte[] uncompressGZip(byte[] data); static byte[] compressSnappy(byte[] data); static byte[] uncompressSnappy(byte[] data);  }### Answer:
@Test public void testCompressGZip() throws IOException { String message = "test dorado compress gzip"; byte[] compressData = CompressUtil.compressGZip(message.getBytes()); byte[] data = CompressUtil.uncompressGZip(compressData); Assert.assertEquals("test dorado compress gzip", new String(data)); compressData = CompressUtil.compressGZip(null); data = CompressUtil.uncompressGZip(compressData); Assert.assertNull(data); }