|
14 | 14 | import java.io.File; |
15 | 15 | import java.nio.file.Path; |
16 | 16 | import java.nio.file.Paths; |
| 17 | +import java.util.Arrays; |
17 | 18 | import java.util.List; |
18 | 19 |
|
19 | 20 | /** API tests for BarcodeApi */ |
@@ -77,6 +78,33 @@ public void getBarcodeRecognizeTest() throws ApiException { |
77 | 78 | assertTrue(region.get(0).getY() > 0); |
78 | 79 | } |
79 | 80 |
|
| 81 | + /** |
| 82 | + * Recognize barcode from a file on server with multiple types in params |
| 83 | + * |
| 84 | + * @throws ApiException if the Api call fails |
| 85 | + */ |
| 86 | + @Test |
| 87 | + public void getBarcodeRecognizeWithTypesTest() throws ApiException { |
| 88 | + String testFileName = "ManyTypes.png"; |
| 89 | + uploadTestFile(testFileName); |
| 90 | + |
| 91 | + GetBarcodeRecognizeRequest request = new GetBarcodeRecognizeRequest(testFileName); |
| 92 | + request.types = |
| 93 | + Arrays.asList( |
| 94 | + DecodeBarcodeType.QR, DecodeBarcodeType.CODE128, DecodeBarcodeType.CODE11); |
| 95 | + request.checksumValidation = ChecksumValidation.OFF.toString(); |
| 96 | + request.preset = PresetType.HIGHPERFORMANCE.toString(); |
| 97 | + request.storage = testStorageName; |
| 98 | + request.folder = remoteTempFolder; |
| 99 | + |
| 100 | + BarcodeResponseList response = api.getBarcodeRecognize(request); |
| 101 | + |
| 102 | + assertNotNull(response); |
| 103 | + assertFalse(response.getBarcodes().isEmpty()); |
| 104 | + |
| 105 | + assertEquals(3, response.getBarcodes().size()); |
| 106 | + } |
| 107 | + |
80 | 108 | private void uploadTestFile(String testFileName) throws ApiException { |
81 | 109 | Path filePath = Paths.get(testDataPath, testFileName); |
82 | 110 | File file = new File(filePath.toString()); |
|
0 commit comments