@Test void find_by_id() { LocationEntity locationEntity = locationEntity(testLocation); when(crudRepository.findById(testLocation.id())).thenReturn(Optional.of(locationEntity)); assertThat(repository.find(testLocation.id())).contains(testLocation); }
@Override public Optional<Location> find(long locationId) { return repository.findById(locationId).map(LocationRepositoryImpl::toDomain); }
LocationRepositoryImpl implements LocationRepository { @Override public Optional<Location> find(long locationId) { return repository.findById(locationId).map(LocationRepositoryImpl::toDomain); } }
LocationRepositoryImpl implements LocationRepository { @Override public Optional<Location> find(long locationId) { return repository.findById(locationId).map(LocationRepositoryImpl::toDomain); } @Autowired  LocationRepositoryImpl(LocationCrudRepository repository); }
LocationRepositoryImpl implements LocationRepository { @Override public Optional<Location> find(long locationId) { return repository.findById(locationId).map(LocationRepositoryImpl::toDomain); } @Autowired  LocationRepositoryImpl(LocationCrudRepository repository); @Override Location createLocation(Coordinates coordinates, String description); @Override List<Location> locations(); @Override Location removeLocation(long id); @Override void removeAll(); @Override Optional<Location> find(long locationId); }
LocationRepositoryImpl implements LocationRepository { @Override public Optional<Location> find(long locationId) { return repository.findById(locationId).map(LocationRepositoryImpl::toDomain); } @Autowired  LocationRepositoryImpl(LocationCrudRepository repository); @Override Location createLocation(Coordinates coordinates, String description); @Override List<Location> locations(); @Override Location removeLocation(long id); @Override void removeAll(); @Override Optional<Location> find(long locationId);  }