### Question:
CmsAspspTppServiceInternal implements CmsAspspTppService { @NotNull @Override public Optional<TppInfo> getTppInfo(@NotNull String tppAuthorisationNumber, @NotNull String instanceId) { Optional<TppInfoEntity> tppInfoEntityOptional = tppInfoRepository.findFirstByAuthorisationNumberAndInstanceId(tppAuthorisationNumber, instanceId); return tppInfoEntityOptional.map(tppInfoMapper::mapToTppInfo); }  @NotNull @Override Optional<TppStopListRecord> getTppStopListRecord(@NotNull String tppAuthorisationNumber, @NotNull String instanceId); @Transactional @Override boolean blockTpp(@NotNull String tppAuthorisationNumber, @NotNull String instanceId, @Nullable Duration lockPeriod); @Transactional @Override boolean unblockTpp(@NotNull String tppAuthorisationNumber, @NotNull String instanceId); @NotNull @Override Optional<TppInfo> getTppInfo(@NotNull String tppAuthorisationNumber, @NotNull String instanceId);  }### Answer:
@Test void getTppInfoRecord_Fail_TppEntityIsNotExistInDB() { when(tppInfoRepository.findFirstByAuthorisationNumberAndInstanceId(AUTHORISATION_NUMBER_NOT_EXISTING, INSTANCE_ID)) .thenReturn(Optional.empty()); Optional<TppInfo> result = cmsAspspTppService.getTppInfo(AUTHORISATION_NUMBER_NOT_EXISTING, INSTANCE_ID); assertFalse(result.isPresent()); }
@Test void getTppInfoRecord_Success_TppEntityIsExistInDB() { when(tppInfoRepository.findFirstByAuthorisationNumberAndInstanceId(AUTHORISATION_NUMBER, INSTANCE_ID)) .thenReturn(Optional.of(tppInfoEntity)); when(tppInfoMapper.mapToTppInfo(tppInfoEntity)) .thenReturn(tppInfo); Optional<TppInfo> result = cmsAspspTppService.getTppInfo(AUTHORISATION_NUMBER, INSTANCE_ID); assertTrue(result.isPresent()); assertEquals(tppInfo, result.get()); }