File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
main/java/uk/gov/companieshouse/orders/api/validator
test/java/uk/gov/companieshouse/orders/api/validator Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 11package uk .gov .companieshouse .orders .api .validator ;
22
3+ import org .apache .commons .lang .StringUtils ;
34import org .springframework .stereotype .Component ;
45import uk .gov .companieshouse .orders .api .dto .AddDeliveryDetailsRequestDTO ;
56
@@ -17,8 +18,8 @@ public List<String> getValidationErrors(final AddDeliveryDetailsRequestDTO addDe
1718 String postalCode = addDeliveryDetailsRequestDTO .getDeliveryDetails ().getPostalCode ();
1819 String region = addDeliveryDetailsRequestDTO .getDeliveryDetails ().getRegion ();
1920
20- if (( postalCode == null || postalCode . isEmpty ()) && ( region == null || region . isEmpty () )) {
21- errors .add ("Post code or Region is required" );
21+ if (StringUtils . isBlank ( postalCode ) && StringUtils . isBlank ( region )) {
22+ errors .add ("Postcode or Region is required" );
2223 }
2324
2425 return errors ;
Original file line number Diff line number Diff line change @@ -48,6 +48,6 @@ void postcodeOrRegionIsMandatory() {
4848
4949 final List <String > errors = deliveryDetailsValidator .getValidationErrors (dto );
5050
51- assertThat (errors , contains ("Post code or Region is required" ));
51+ assertThat (errors , contains ("Postcode or Region is required" ));
5252 }
5353}
You can’t perform that action at this time.
0 commit comments