优化
This commit is contained in:
+18
@@ -350,6 +350,24 @@ class LoadingDeliveryServiceTest {
|
||||
"PHOTO_STEP_1".equals(value.getEvidenceType()) && "ACTIVE".equals(value.getStatus())));
|
||||
}
|
||||
|
||||
@Test
|
||||
void replaysTheSameActiveEvidenceFileWithoutAppendingAnotherRecord() {
|
||||
when(repository.claimOperation(anyLong(), anyLong(), anyLong(), anyString(), anyString(), anyString())).thenReturn(true);
|
||||
when(repository.findInbound(10, 20)).thenReturn(new Snapshot(20L, 10L, "LOADING", 3));
|
||||
LoadingEvidenceEntity existing = evidence("SEAL", 11L, "LOCK-001");
|
||||
existing.setId(99L); existing.setInboundId(20L); existing.setTenantId(10L); existing.setStatus("ACTIVE");
|
||||
when(repository.findEvidenceBySealNo(10, "LOCK-001")).thenReturn(existing);
|
||||
when(repository.findActiveEvidenceByFile(10, 20, "SEAL", 11L)).thenReturn(existing);
|
||||
when(repository.listEvidence(10, 20)).thenReturn(List.of(existing));
|
||||
|
||||
LoadingActionResponse result = service.upsertEvidence(10, 20, 7, "admin", "same-seal-photo",
|
||||
new UpsertEvidenceRequest(0, "SEAL", 11L, null, "LOCK-001", null));
|
||||
|
||||
assertThat(result.evidences().evidences()).hasSize(1);
|
||||
verify(repository, never()).createEvidence(any());
|
||||
verify(files, never()).validate(anyString(), anyLong(), anyLong(), anyLong());
|
||||
}
|
||||
|
||||
@Test
|
||||
void voidsPhotoWithReasonAndKeepsTheRecord() {
|
||||
when(repository.claimOperation(anyLong(), anyLong(), anyLong(), anyString(), anyString(), anyString())).thenReturn(true);
|
||||
|
||||
Reference in New Issue
Block a user