新增征信解析测试基础
This commit is contained in:
@@ -44,5 +44,11 @@
|
|||||||
<groupId>org.springdoc</groupId>
|
<groupId>org.springdoc</groupId>
|
||||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.ruoyi.lsfx.client;
|
||||||
|
|
||||||
|
class CreditParseClientTest {
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.lsfx.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.mock.web.MockMultipartFile;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
class CreditParseControllerTest {
|
||||||
|
|
||||||
|
private final CreditParseController controller = new CreditParseController();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void parse_shouldRejectEmptyFile() {
|
||||||
|
AjaxResult result = controller.parse(null, null, null);
|
||||||
|
assertEquals(500, result.get("code"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void parse_shouldRejectNonHtmlFile() {
|
||||||
|
MockMultipartFile file = new MockMultipartFile(
|
||||||
|
"file", "credit.pdf", "application/pdf", "x".getBytes(StandardCharsets.UTF_8)
|
||||||
|
);
|
||||||
|
AjaxResult result = controller.parse(file, null, null);
|
||||||
|
assertEquals(500, result.get("code"));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user