Package encoder.primitive

Source Code of encoder.primitive.StringEncoderTest

package encoder.primitive;

import decoder.primitive.StringDecoder;
import org.junit.Assert;
import org.junit.Test;

import java.io.ByteArrayInputStream;

/**
* If you see it, than I've forgotten javadoc
*
* @author Denis Golovachev
* @author $Author$ (current maintainer)
* @since 1.0
*/
public class StringEncoderTest {
    @Test
    public void testEncode() throws Exception {
        String[] testStr = {"abc", "tdd", "agile", "java"};
        for (String str: testStr) {
            byte[] encoded = new StringEncoder().encode(str);
            String decoded = new StringDecoder().decode(new ByteArrayInputStream(encoded));
            Assert.assertEquals(str, decoded);
        }
    }


    @Test
    public void testLongStringEncode() throws Exception {
        String testStr =
                "abcaasadasdasdasdaahsdlffsdafdsf32342nadsjasfasdfasdfasdjh2342323234adasdfdsacvafdfphjjhjladf" +
                        "sdafasdfsdfasfasdfasdfasdfasfsadfsdfasfwqerqwrqwerwrqrqwrewqwerwqrwqerwqrwrqwrweqrwerqwr" +
                        "qwerwqerwqrwerwqerewqrqwerqwerqwrwqrweqwrwqrwqerqwrwqrqwerqwr211222ssssssssssssssssssss";
        byte[] encoded = new StringEncoder().encode(testStr);
        String decoded = new StringDecoder().decode(new ByteArrayInputStream(encoded));
        Assert.assertEquals(testStr, decoded);
    }

}
TOP

Related Classes of encoder.primitive.StringEncoderTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.