优化
This commit is contained in:
+25
@@ -69,6 +69,31 @@ class InboundCartonLabelPrintServiceTest {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void multiplePreGeneratedPalletsAreReturnedInOnePdf() {
|
||||
Pallet first = dropshipPallet("OPEN");
|
||||
Pallet second = new Pallet(90002L, "DP-260911-0002", "OPEN", 0, 0, 0,
|
||||
BigDecimal.ZERO, BigDecimal.ZERO, 1, List.of(), List.of(), null);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_PDF);
|
||||
when(print.generateDropshipPalletA4Documents(org.mockito.ArgumentMatchers.anyString(),
|
||||
org.mockito.ArgumentMatchers.eq("request-all"), org.mockito.ArgumentMatchers.any()))
|
||||
.thenReturn(new ResponseEntity<>(new byte[] {4, 5, 6}, headers,
|
||||
org.springframework.http.HttpStatus.OK));
|
||||
|
||||
ResponseEntity<byte[]> response = service.generateDropshipPallets(
|
||||
List.of(first, second), "PCHK2608040174", "request-all");
|
||||
|
||||
ArgumentCaptor<PrintPdfClient.DropshipPalletA4PdfRequest> request =
|
||||
ArgumentCaptor.forClass(PrintPdfClient.DropshipPalletA4PdfRequest.class);
|
||||
verify(print).generateDropshipPalletA4Documents(org.mockito.ArgumentMatchers.eq("internal-token"),
|
||||
org.mockito.ArgumentMatchers.eq("request-all"), request.capture());
|
||||
assertThat(request.getValue().documents()).extracting("palletNo")
|
||||
.containsExactly("DP-260911-0001", "DP-260911-0002");
|
||||
assertThat(request.getValue().downloadFileName()).contains("2托");
|
||||
assertThat(response.getBody()).containsExactly(4, 5, 6);
|
||||
}
|
||||
|
||||
@Test
|
||||
void forwardsStableLabelsAndOnlySafePdfHeaders() {
|
||||
when(labels.list(10001L, 70001L, List.of(1))).thenReturn(batch());
|
||||
|
||||
Reference in New Issue
Block a user