### Question:
CmsPsuService { public Optional<PsuData> definePsuDataForAuthorisation(PsuData psuDataForCheck, List<PsuData> psuDataList) { return Optional.ofNullable(psuDataForCheck) .map(psuData -> psuDataList.stream() .filter(psu -> StringUtils.equals(psu.getPsuId(), psuData.getPsuId())) .findFirst() .orElse(psuDataForCheck)); }  Optional<PsuData> definePsuDataForAuthorisation(PsuData psuDataForCheck, List<PsuData> psuDataList); List<PsuData> enrichPsuData(PsuData psuData, List<PsuData> psuDataList); boolean isPsuDataNew(PsuData psuData, List<PsuData> psuDataList); boolean isPsuDataListEqual(@NotNull List<PsuData> psuDataList, @NotNull List<PsuData> anotherPsuDataList); boolean isPsuDataRequestCorrect(PsuData psuRequest, PsuData psuAuth);  }### Answer:
@Test void definePsuDataForAuthorisation_PsuIsExistInList() { Optional<PsuData> actualResult = cmsPsuService.definePsuDataForAuthorisation(PSU_DATA_1, PSU_DATA_LIST); assertTrue(actualResult.isPresent()); assertEquals(PSU_DATA_LIST.get(0), actualResult.get()); }
@Test void definePsuDataForAuthorisation_PsuIsNotExistInList() { Optional<PsuData> actualResult = cmsPsuService.definePsuDataForAuthorisation(PSU_DATA_3, PSU_DATA_LIST); assertTrue(actualResult.isPresent()); assertEquals(PSU_DATA_3, actualResult.get()); }