fix(aihr): require explicit candidate review status
This commit is contained in:
+3
-3
@@ -227,12 +227,12 @@ public class AihrCandidateMaterialService {
|
||||
return name;
|
||||
}
|
||||
|
||||
private static String normalizeReviewStatus(String status) {
|
||||
String text = clean(status, "待审核");
|
||||
static String normalizeReviewStatus(String status) {
|
||||
String text = clean(status, "");
|
||||
if ("已通过".equals(text) || "已驳回".equals(text) || "待审核".equals(text)) {
|
||||
return text;
|
||||
}
|
||||
throw new IllegalArgumentException("审核状态只能是待审核、已通过或已驳回");
|
||||
throw new IllegalArgumentException("审核接口必须明确提交待审核、已通过或已驳回");
|
||||
}
|
||||
|
||||
public record MaterialResponse(Long id, Long ossId, String fileName, String materialType, Long fileSize, String status, String time) {
|
||||
|
||||
+10
@@ -34,4 +34,14 @@ class AihrCandidateMaterialServiceTest {
|
||||
assertEquals(".._.._candidate.pdf", AihrCandidateMaterialService.sanitizeMaterialFileName("../../candidate.pdf"));
|
||||
assertEquals("candidate_ name.pdf", AihrCandidateMaterialService.sanitizeMaterialFileName("candidate\t name.pdf"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Tag("dev")
|
||||
void reviewStatusMustBeExplicit() {
|
||||
assertEquals("已通过", AihrCandidateMaterialService.normalizeReviewStatus(" 已通过 "));
|
||||
assertEquals("已驳回", AihrCandidateMaterialService.normalizeReviewStatus("已驳回"));
|
||||
assertThrows(IllegalArgumentException.class, () -> AihrCandidateMaterialService.normalizeReviewStatus(null));
|
||||
assertThrows(IllegalArgumentException.class, () -> AihrCandidateMaterialService.normalizeReviewStatus(""));
|
||||
assertThrows(IllegalArgumentException.class, () -> AihrCandidateMaterialService.normalizeReviewStatus("未知状态"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user