From 818a4d2b977df098fc8c805baf9151ded0d077c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BA=B7?= Date: Thu, 17 Aug 2017 21:51:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/itkk/udf/qrcode/QrCodeTest.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/udf-starter-qrcode/src/test/java/org/itkk/udf/qrcode/QrCodeTest.java b/udf-starter-qrcode/src/test/java/org/itkk/udf/qrcode/QrCodeTest.java index 1cf3a22..b98d3c7 100644 --- a/udf-starter-qrcode/src/test/java/org/itkk/udf/qrcode/QrCodeTest.java +++ b/udf-starter-qrcode/src/test/java/org/itkk/udf/qrcode/QrCodeTest.java @@ -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(""); } catch (Exception e) { e.printStackTrace();