I have an entity and a Junit, I want to test that update method is working fine, but when I invoke save method from CrudRepository I get a new entry in my table instead of the u
I think the repository should be
public interface PersonRepository extends CrudRepository {
As your Id is Integer not String, also I assume that your
personService.createPerson(person);
Internally use save method of the repo.
My second advice is the
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)}
This mean that the app Context need to be generated again also beans, so please be sure that your configuration in persistence.xml is not having h2bml set to create. Also consider to call flush method in your service.