@Test void find_by_id() { VehicleEntity vehicleEntity = vehicleEntity(testVehicle); when(crudRepository.findById(testVehicle.id())).thenReturn(Optional.of(vehicleEntity)); assertThat(repository.find(testVehicle.id())).contains(testVehicle); }
@Override public Optional<Vehicle> find(long vehicleId) { return repository.findById(vehicleId).map(VehicleRepositoryImpl::toDomain); }
VehicleRepositoryImpl implements VehicleRepository { @Override public Optional<Vehicle> find(long vehicleId) { return repository.findById(vehicleId).map(VehicleRepositoryImpl::toDomain); } }
VehicleRepositoryImpl implements VehicleRepository { @Override public Optional<Vehicle> find(long vehicleId) { return repository.findById(vehicleId).map(VehicleRepositoryImpl::toDomain); } VehicleRepositoryImpl(VehicleCrudRepository repository); }
VehicleRepositoryImpl implements VehicleRepository { @Override public Optional<Vehicle> find(long vehicleId) { return repository.findById(vehicleId).map(VehicleRepositoryImpl::toDomain); } VehicleRepositoryImpl(VehicleCrudRepository repository); @Override Vehicle createVehicle(int capacity); @Override Vehicle createVehicle(VehicleData vehicleData); @Override List<Vehicle> vehicles(); @Override Vehicle removeVehicle(long id); @Override void removeAll(); @Override Optional<Vehicle> find(long vehicleId); @Override void update(Vehicle vehicle); }
VehicleRepositoryImpl implements VehicleRepository { @Override public Optional<Vehicle> find(long vehicleId) { return repository.findById(vehicleId).map(VehicleRepositoryImpl::toDomain); } VehicleRepositoryImpl(VehicleCrudRepository repository); @Override Vehicle createVehicle(int capacity); @Override Vehicle createVehicle(VehicleData vehicleData); @Override List<Vehicle> vehicles(); @Override Vehicle removeVehicle(long id); @Override void removeAll(); @Override Optional<Vehicle> find(long vehicleId); @Override void update(Vehicle vehicle);  }