package com.dubravsky.arcache.compress;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.io.IOException;

import static org.junit.Assert.assertEquals;

public class GzipCompressorTest {

    private static final String INPUT = "Sed pulvinar cursus diam, et vestibulum lectus molestie et.";

    private GzipCompressor compressor;

    @BeforeMethod
    public void init() {
        compressor = new GzipCompressor();
    }

    @Test
    public void shouldCompressAndDecompress() throws IOException {
        byte[] compressedData = compressor.compress(INPUT);
        String decompressedString = compressor.decompress(compressedData);

        assertEquals(INPUT, decompressedString);
    }

    @Test
    public void shouldCompressAndDecompressNull() throws IOException {
        byte[] compressedData = compressor.compress(null);
        String decompressedString = compressor.decompress(compressedData);

        assertEquals(null, decompressedString);
    }

    @Test
    public void shouldCompressAndDecompressEmptyString() throws IOException {
        byte[] compressedData = compressor.compress("");
        String decompressedString = compressor.decompress(compressedData);

        assertEquals("", decompressedString);
    }

}

@@ -166,33 +166,128 @@
 org.
-junit.Assert.assertEquals
+hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.hamcrest.Matchers.nullValue
 ;%0A%0Ap
@@ -788,22 +788,13 @@
 sert
-Equals(INPUT, 
+That(
 deco
@@ -799,32 +799,43 @@
 compressedString
+, is(INPUT)
 );%0A    %7D%0A%0A    @T
@@ -1062,21 +1062,13 @@
 sert
-Equals(null, 
+That(
 deco
@@ -1073,32 +1073,49 @@
 compressedString
+, is(nullValue())
 );%0A    %7D%0A%0A    @T
@@ -1347,19 +1347,13 @@
 sert
-Equals(%22%22, 
+That(
 deco
@@ -1366,16 +1366,24 @@
 edString
+, is(%22%22)
 );%0A    %7D

migrate to hamcrest matchers