VehicleRepositoryImpl implements VehicleRepository { @Override public void update(Vehicle vehicle) { repository.save(new VehicleEntity(vehicle.id(), vehicle.name(), vehicle.capacity())); } 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);  }
@Test void update() { repository.update(testVehicle); verify(crudRepository).save(vehicleEntityCaptor.capture()); VehicleEntity savedVehicle = vehicleEntityCaptor.getValue(); assertThat(savedVehicle.getId()).isEqualTo(testVehicle.id()); assertThat(savedVehicle.getName()).isEqualTo(testVehicle.name()); assertThat(savedVehicle.getCapacity()).isEqualTo(testVehicle.capacity()); }