This commit is contained in:
2026-09-20 15:49:29 +08:00
parent 75c2bd092f
commit 0dec690235
3 changed files with 34 additions and 1 deletions
@@ -146,6 +146,26 @@ class InboundCartonLabelPrintServiceTest {
assertThat(request.getValue().documents().get(1).skuRows()).hasSize(1);
}
@Test
void printsPalletDocumentWhenCustomerNicknameIsMissing() {
Pallet pallet = dropshipPallet("OPEN");
stubPalletFacts(90001L);
when(customerSnapshots.customerNicknameForPrint(10001L)).thenReturn("—");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_PDF);
when(print.generateDropshipPalletA4Documents(org.mockito.ArgumentMatchers.anyString(),
org.mockito.ArgumentMatchers.eq("request-missing-nickname"), org.mockito.ArgumentMatchers.any()))
.thenReturn(new ResponseEntity<>(new byte[] {1}, headers, org.springframework.http.HttpStatus.OK));
service.generateDropshipPallet(pallet, "PCHK2608040174", "request-missing-nickname");
ArgumentCaptor<PrintPdfClient.DropshipPalletA4PdfRequest> request =
ArgumentCaptor.forClass(PrintPdfClient.DropshipPalletA4PdfRequest.class);
verify(print).generateDropshipPalletA4Documents(org.mockito.ArgumentMatchers.anyString(),
org.mockito.ArgumentMatchers.eq("request-missing-nickname"), request.capture());
assertThat(request.getValue().documents().get(0).inboundRows().get(0).customerNickname()).isEqualTo("—");
}
@Test
void forwardsStableLabelsWithoutSkuAndOnlySafePdfHeaders() throws Exception {
when(labels.list(10001L, 70001L, List.of(1))).thenReturn(batch());