After a recent change, the shipment summary service has started sometimes returning an unexpected result during batch processing. We need to review the diff and find defects in the new implementation.
collect(List<String> shipmentIds) method accepts a list of shipment identifiers in request order.statuses — no more than one entry for each unique shipmentId;failedShipmentIds — identifiers for which status retrieval ended in an error.shipmentId is passed multiple times, it must appear no more than once in both statuses and failedShipmentIds.shipmentId must not prevent processing of the other elements.ShipmentStatusService.shipmentIds where:
ShipmentGateway;ShipmentStatusBatch must contain all successfully retrieved statuses for unique identifiers.failedShipmentIds.shipmentId must not lead to duplicate work in the result.javac *.javajava DemoCompletableFuture + Executors.newFixedThreadPool(4)ShipmentGateway contract:
fetchStatus(String shipmentId) returns a string status;shipmentId starting with ERR-, throws IllegalStateExceptionUse line comments to explain the problem, its impact, the fix and how to test it.