Skip to content

Commit

Permalink
DT-826: Review comments for DT-826
Browse files Browse the repository at this point in the history
Signed-off-by: Niels Thykier <[email protected]>
  • Loading branch information
nt-gt committed Jan 5, 2024
1 parent 90eafb4 commit 3715003
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"HSCodes": [
"640510"
],
"commoditySubreference": "Some Commodity Subreference 123",
"cargoItems": [
{
"equipmentReference": "NARU3472484",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,17 +384,20 @@ private static <T> Supplier<T> cspValue(Supplier<CarrierScenarioParameters> cspS
};
}

private static void generateCSPRelatedChecks(List<JsonContentCheck> checks, Supplier<CarrierScenarioParameters> cspSupplier) {
private static void generateCSPRelatedChecks(List<JsonContentCheck> checks, Supplier<CarrierScenarioParameters> cspSupplier, boolean isTD) {
checks.add(JsonAttribute.allIndividualMatchesMustBeValid(
"[Scenario] Verify that the correct 'carrierBookingReference' is used",
mav -> mav.path("consignmentItems").all().path("carrierBookingReference").submitPath(),
JsonAttribute.matchedMustEqual(cspValue(cspSupplier, CarrierScenarioParameters::carrierBookingReference))
));
checks.add(JsonAttribute.allIndividualMatchesMustBeValid(
"[Scenario] Verify that the correct 'commoditySubreference' is used",
mav -> mav.path("consignmentItems").all().path("commoditySubreference").submitPath(),
JsonAttribute.matchedMustEqual(cspValue(cspSupplier, CarrierScenarioParameters::commoditySubreference))
));
if (!isTD) {
checks.add(
JsonAttribute.allIndividualMatchesMustBeValid(
"[Scenario] Verify that the correct 'commoditySubreference' is used",
mav -> mav.path("consignmentItems").all().path("commoditySubreference").submitPath(),
JsonAttribute.matchedMustEqual(
cspValue(cspSupplier, CarrierScenarioParameters::commoditySubreference))));
}
checks.add(JsonAttribute.allIndividualMatchesMustBeValid(
"[Scenario] Verify that the correct 'equipmentReference' is used",
mav -> {
Expand Down Expand Up @@ -433,7 +436,7 @@ private static void generateCSPRelatedChecks(List<JsonContentCheck> checks, Supp

public static ActionCheck siRequestContentChecks(UUID matched, Supplier<CarrierScenarioParameters> cspSupplier) {
var checks = new ArrayList<>(STATIC_SI_CHECKS);
generateCSPRelatedChecks(checks, cspSupplier);
generateCSPRelatedChecks(checks, cspSupplier, false);
return JsonAttribute.contentChecks(
EblRole::isShipper,
matched,
Expand Down Expand Up @@ -461,7 +464,7 @@ public static ActionCheck siResponseContentChecks(UUID matched, Supplier<Carrier
checks.add(updatedStatusCheck);
}
checks.addAll(STATIC_SI_CHECKS);
generateCSPRelatedChecks(checks, cspSupplier);
generateCSPRelatedChecks(checks, cspSupplier, true);
return JsonAttribute.contentChecks(
EblRole::isCarrier,
matched,
Expand Down

0 comments on commit 3715003

Please sign in to comment.