修改单元测试

This commit is contained in:
王康
2017-08-17 21:51:19 +08:00
parent cd2699db96
commit 818a4d2b97
@@ -6,18 +6,30 @@ import com.google.zxing.NotFoundException;
import org.itkk.udf.qrcode.domain.QrCodeRequest;
import org.itkk.udf.qrcode.service.QrcodeService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.IOException;
/**
* QrCodeTest
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = QrcodeService.class)
public class QrCodeTest {
/**
* qrcodeService
*/
@Autowired
private QrcodeService qrcodeService;
@Test
public void testDepaseQrCode() throws FormatException, ChecksumException, NotFoundException, IOException {
String img = "https://static.oschina.net/uploads/img/201707/09205944_0PzS.jpg";
String ans = new QrcodeService().decode(img);
String ans = qrcodeService.decode(img);
System.out.println(ans);
}
@@ -28,7 +40,7 @@ public class QrCodeTest {
try {
QrCodeRequest request = new QrCodeRequest();
request.setContent(msg);
String out = new QrcodeService().parse(request);
String out = qrcodeService.parse(request);
System.out.println("<img src=\"data:image/png;base64," + out + "\" />");
} catch (Exception e) {
e.printStackTrace();