package org.craft.atom.util;

import java.io.IOException;
import java.nio.charset.Charset;

import junit.framework.Assert;

import org.junit.Test;

/**
 * Test for {@code GzipUtil}
 * 
 * @author mindwind
 * @version 1.0, Feb 9, 2013
 */
public class GzipUtilTest {
	
	@Test public void test() throws IOException {
		String raw = "这是一个gzip压缩测试!!~~hhhllsjf123123";
		byte[] gzipData = GzipUtil.gzip(raw.getBytes(Charset.defaultCharset()));
		System.out.println("gzip=" + new String(gzipData, Charset.defaultCharset()));
		String ungzipData = new String(GzipUtil.ungzip(gzipData), Charset.defaultCharset());
		System.out.println("ungzip=" + ungzipData);
		Assert.assertEquals(raw, ungzipData);
	}
	
}

@@ -308,16 +308,62 @@
 ption %7B%0A
+%09%09Charset charset = Charset.forName(%22utf-8%22);%0A
 %09%09String
@@ -454,32 +454,15 @@
 tes(
-C
+c
 harset
-.defaultCharset()
 ));%0A
@@ -517,32 +517,15 @@
 ta, 
-C
+c
 harset
-.defaultCharset()
 ));%0A
@@ -588,32 +588,15 @@
 a), 
-C
+c
 harset
-.defaultCharset()
 );%0A%09

fix - Gzip unit test may fail in default charset