mirror of
https://gitee.com/wangkang/udf.git
synced 2026-10-30 03:53:41 +00:00
修改单元测试
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user