Skip to content

Metadata/ServiceAgreementQualityService: Standardise on List<MetadataCheck> instead of Optionals

Joshua Holland requested to merge DCDEV-43-refactor-qualityservices into develop

The checking methods in the two quality service classes previously mostly returned Optional<List>, with a few simply Optional. However, there was no situation in which Optional.of(Collections.emptyList()) could meaningfully be returned. Therefore the optional is redundant, and an empty list can be used anywhere Optional.empty() was before. This means that it's now simpler to compose multiple checks by concatenating lists rather than checking for empty Optionals.

Also refactor the tests to use more expressive matchers instead of validating booleans.

There are also many other miscellaneous improvements and style changes, including fixing the logic of some tests using Stream.noneMatch(condition) when they should be using Stream.anyMatch(!condition).

DCDEV-43

Closes DCDEV-43

Merge request reports

Loading