@Test
void create_vehicle_from_given_data() {

    // arrange
    VehicleEntity newEntity = vehicleEntity(testVehicle);
    when(crudRepository.save(vehicleEntityCaptor.capture())).thenReturn(newEntity);
    VehicleData vehicleData = VehicleFactory.vehicleData("x", 1);
    // act
    Vehicle newVehicle = repository.createVehicle(vehicleData);
    // assert
    // -- the correct values were used to save the entity
    VehicleEntity savedVehicle = vehicleEntityCaptor.getValue();
    assertThat(savedVehicle.getName()).isEqualTo(vehicleData.name());
    assertThat(savedVehicle.getCapacity()).isEqualTo(vehicleData.capacity());
    // -- created domain vehicle is equal to the entity returned by repository.save()
    assertThat(newVehicle.id()).isEqualTo(newEntity.getId());
    assertThat(newVehicle.name()).isEqualTo(newEntity.getName());
    assertThat(newVehicle.capacity()).isEqualTo(newEntity.getCapacity());
}