FACT-2610 Counter service#303
Conversation
Plan Result (aat)
|
Plan Result (prod)
|
| extends JpaRepository<CourtCounterServiceOpeningHours, UUID> { | ||
|
|
||
| Optional<CourtCounterServiceOpeningHours> findByCourtId(UUID courtId); | ||
| Optional<List<CourtCounterServiceOpeningHours>> findByCourtId(UUID courtId); |
There was a problem hiding this comment.
The standard contract for Spring Data is that list queries typically return List rather than Optional<List> as it can complicate semantics. In any case where there are no results JPA/Spring Data will alway return an empty list.
In our other repositories we either return a List<T> or a Page<T> when returning multiple results, so we should change this to conform.
| when(courtCounterServiceOpeningHoursRepository.findByCourtIdAndId(courtId, counterServiceOpeningHours.getId())) | ||
| .thenReturn(Optional.empty()); | ||
|
|
||
| assertThrows( |
There was a problem hiding this comment.
We have a few of these in the code, but if you want to get shot of the sonar warning, I think you just need to move the counterServiceOpeningHours.getId() call outside of the lambda. I think the complaint is that from a purist perspective, that could potentially throw an NPE.
| } | ||
|
|
||
| @Test | ||
| void getCounterServiceOpeningHoursThrowsExceptionWhenNotFound() { |
There was a problem hiding this comment.
Complete nitpick here, and might be wrong, but I think the naming convention in the file suggests that this method should be called getCounterServiceOpeningHoursByIdThrowsExceptionWhenNotFound
|



JIRA link
https://tools.hmcts.net/jira/browse/FACT-2610
Change description
Implement Counter service - admin for new FaCT
Does this PR require manual testing? (check one with "x")
Does this PR introduce a breaking change? (check one with "x")