mmnaseri / spring-data-mock

Mock facility for Spring Data repositories
MIT License
137 stars 44 forks source link

`deleteById` tries to treat the key as an entity instance #181

Closed mmnaseri closed 3 years ago

mmnaseri commented 3 years ago

Describe the bug The CrudRepository interface from Spring Data defines deleteById like so:

void deleteById(ID id);

where T is the entity type and ID is the key type.

Our implementation instead treats the id argument as the entity.

To Reproduce

CarRepository repo = builder().mock(CarRepository.class);
repo.deleteById("hello");

Expected behavior

Item is correctly deleted.