fix(delivery): expose signed quantity and publish correct signature instant
This commit is contained in:
+18
-2
@@ -61,12 +61,28 @@ class DeliveryLongIdJsonContractTest {
|
||||
});
|
||||
}
|
||||
|
||||
private DeliveryResponses.DeliveryRow deliveryRow() {
|
||||
@Test
|
||||
void signedPackagesMustPreserveNullZeroAndPositiveDatabaseFacts() {
|
||||
contextRunner.run(context -> {
|
||||
ObjectMapper objectMapper = context.getBean(ObjectMapper.class);
|
||||
objectMapper.setSerializationInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL);
|
||||
for (Integer count : new Integer[] {null, 0, 3}) {
|
||||
JsonNode json = objectMapper.readTree(objectMapper.writeValueAsString(deliveryRow(count)));
|
||||
assertThat(json.has("signedPackages")).isTrue();
|
||||
if (count == null) assertThat(json.get("signedPackages").isNull()).isTrue();
|
||||
else assertThat(json.get("signedPackages").intValue()).isEqualTo(count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private DeliveryResponses.DeliveryRow deliveryRow() { return deliveryRow(null); }
|
||||
|
||||
private DeliveryResponses.DeliveryRow deliveryRow(Integer signedPackages) {
|
||||
return new DeliveryResponses.DeliveryRow(
|
||||
DELIVERY_ID,
|
||||
null, null, "PS-1", null, null, null, null, "CREATED", null,
|
||||
null, null, null, null, null, null, null, null, null, null, null,
|
||||
0, 0, null, null, null, null, null, null, null, null, 0, java.util.List.of(), null,
|
||||
0, 0, signedPackages, null, null, null, null, null, null, null, null, 0, java.util.List.of(), null,
|
||||
com.baiyue.lastleg.delivery.service.DeliveryDocumentSnapshot.summary(null), null, null, null,
|
||||
null, null, null, null, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user