### Question:
CloudRegionDao extends NamedParameterJdbcDaoSupport { public Optional<AbstractCloudRegionCredentials> loadCredentials(final Long id) { final MapSqlParameterSource parameterSource = new MapSqlParameterSource(); parameterSource.addValue(CloudRegionParameters.REGION_ID.name(), id); return getNamedParameterJdbcTemplate() .query(loadCredentialsByRegionId, parameterSource, getCredentialsRowMapper()) .stream() .filter(Objects::nonNull) .findFirst(); } CloudRegionDao(final String loadRegionByIdQuery,
                          final String loadRegionByNameQuery,
                          final String loadAllRegionsQuery,
                          final String createRegionQuery,
                          final String updateRegionQuery,
                          final String deleteRegionQuery,
                          final String loadDefaultRegionQuery,
                          final String loadRegionByRegionNameQuery,
                          final String loadByProviderAndRegionCodeQuery,
                          final String loadCredentialsByRegionId,
                          final List<CloudRegionDaoHelper> helpers); Optional<AbstractCloudRegion> loadById(final long id); Optional<AbstractCloudRegion> loadDefaultRegion(); Optional<AbstractCloudRegion> loadByName(final String name); Optional<AbstractCloudRegion> loadByRegionName(final String regionName); List<? extends AbstractCloudRegion> loadAll(); AbstractCloudRegion create(final AbstractCloudRegion region); AbstractCloudRegion create(final AbstractCloudRegion region,
                                      final AbstractCloudRegionCredentials credentials); void update(final AbstractCloudRegion region, final AbstractCloudRegionCredentials credentials); void delete(final Long id); Optional<AbstractCloudRegion> loadByProviderAndRegionCode(final CloudProvider provider,
                                                                     final String regionCode); Optional<AbstractCloudRegionCredentials> loadCredentials(final Long id);  }### Answer:
@Test public void loadCredentialsShouldReturnNoCredentialsIfRegionDoNotExist() { assertFalse(cloudRegionDao.loadCredentials(-1L).isPresent()); }