package com.qmth.boot.test.tools.zxing;

import com.google.zxing.WriterException;
import com.qmth.boot.tools.zxing.BarcodeDecoder;
import com.qmth.boot.tools.zxing.BarcodeEncoder;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

public class BarcodeTest {

    @Test
    public void test() throws IOException, WriterException {
        String content = RandomStringUtils.random(16, true, true);
        Assert.assertEquals(content,
                BarcodeDecoder.decode(BarcodeEncoder.encode(content, 400, 100).toInputStream(), null));
    }
}
